:PROPERTIES: :ID: ecee1a61-3d5c-4c8f-a205-67e5278beed6 :END: #+title: Flatpak packages #+date: "2021-06-27 23:46:41 +08:00" #+date_modified: "2021-12-13 17:04:58 +08:00" #+language: en A Flatpak package usually is an application that depends on runtimes which are collections of library. For more information, Flatpak has a [[https://docs.flatpak.org/][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 [[id:53061a97-e907-4a31-9109-a2f6c57c6e22][Open Build Service]] projects. - The *manifest* is the term for package definition which will be passed into the builder service similar to [[id:963c043e-4972-4b29-8360-223ec3465203][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 [[id:963c043e-4972-4b29-8360-223ec3465203][Nix packages]] and [[id:be917383-84c4-4bf5-9ca0-b04bfb778f4f][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 [[id:fe9e21bc-3b38-4d0f-a785-253248a38ed7][Reproducible builds]] - examples: + [[https://github.com/flathub/com.mojang.Minecraft/][Minecraft]] is fairly simple by fetching the compiled binary and its dependencies with minimal compilation needed + [[https://github.com/flathub/com.rawtherapee.RawTherapee][RawTherapee]] is slightly complex with various dependencies defined mostly in one file + [[https://github.com/flathub/org.gnucash.GnuCash][Gnucash]] has a complex manifest that is composed of multiple dependencies packages as its own module file + [[https://github.com/flathub/org.libretro.RetroArch][RetroArch]] is similarly complex to Gnucash with its vendored dependencies packaged as its own module - Flathub has a [[https://github.com/flatpak/flatpak-builder-tools][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 [[https://github.com/flathub/shared-modules/][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 [[https://github.com/flatpak/flatpak-builder-tools/tree/68aacd5d076070db2dd5eca2a86f15955bcd700b][flatpak-builder-tools]] will not build with binary wheels; as of the linked commit, it does accept it [[https://github.com/flatpak/flatpak-builder-tools/blob/68aacd5d076070db2dd5eca2a86f15955bcd700b/pip/flatpak-pip-generator#L229][but only in certain formats]]