# Flatpak packages

Date: 2021-06-27 23:46:41 +08:00Date modified: 2021-12-13 17:04:58 +08:00

A Flatpak package usually is an application that depends on runtimes which are collections of library. For more information, Flatpak has a documentation page complete with references and tutorials to get started.

# Terminologies

To get us on the same page very quickly, here's the terminologies you'll encounter when dealing with Flatpak.

- Remotes are the repositories of packages in a similar vein to Open Build Service projects.

- The manifest is the term for package definition which will be passed into the builder service similar to Nix packages.

- Runtimes are a bundle of libraries and applications to be shared from several packages. This is how Flatpak reduces the total build size for all packages. Among others, it has runtime for Freedesktop, GNOME, and KDE platforms.

- Base applications are smaller bundles of libraries not large enough to be a runtime. It enables control by adding this mini-bundle into a package. This is typically specialized in scope (e.g., Electron applications).

# Extra information

- you can run the runtimes to know the installed packages (e.g., `flatpak run org.freedesktop.Sdk//19.08`)

- Flatpak can create bundles from a manifest, enabling easier distribution without a Flatpak remote

- similar to Nix packages and Guix package manager, sandboxing is an important part of the build process; thus, there are limitations such as no network availability, filesystem access, and socket access; by default, applications only have access to their runtime folders

- Flathub, the main repository, is concerned with Reproducible builds

- examples:

  - Minecraft is fairly simple by fetching the compiled binary and its dependencies with minimal compilation needed

  - RawTherapee is slightly complex with various dependencies defined mostly in one file

  - Gnucash has a complex manifest that is composed of multiple dependencies packages as its own module file

  - RetroArch is similarly complex to Gnucash with its vendored dependencies packaged as its own module

- Flathub has a curated set of scripts to automate building manifests for several projects such as Python, Rust, and Node similar to roam:nixpkgs

- Flathub also has a collection of modules intended to be shared among the repo serving as an additional base for the most common dependencies that cannot be found in runtimes

# Nuances

- the pip generator from flatpak-builder-tools will not build with binary wheels; as of the linked commit, it does accept it but only in certain formats

## Backlinks

- Nix derivations