An intro to the Flatpak framework for building and distributing desktop apps

Flatpak: A new framework for building and distributing desktop applications

Flatpak: A new framework for building and distributing desktop applications
Image by : 

opensource.com

Fragmentation is a longstanding Achilles heel for the Linux desktop. In a world of myriad incompatible distributions, popular apps are typically limited to one or two of the most popular distributions, and the creation of new apps is stifled. The impact of fragmentation on application developers offers a good example of the problem: To release an app for Linux, a developer must contend with different package formats and a baffling number of distributions, all of which have their own particular conventions. For those apps that do exist, maintenance and pre-release testing is difficult, if not impossible.

The constantly changing nature of Linux distributions adds another dimension of complexity for the application developer. Each release of a distribution can bring changes that are incompatible with applications, causing bugs or stopping the app from working altogether. When problems do emerge, users often encounter them first, before developers do.

Flatpak, a new framework for building and distributing desktop applications, is intended to change all this. Flatpak decouples the platforms on which applications run from the distributions. This means that, instead of chasing distributions, application developers get to pick the platform that they want to use. Flatpak then makes sure that that platform is available on all the various distributions.

Because Flatpak platforms are fixed, application developers don't need to worry about them changing unexpectedly, and they can test their applications against the platforms prior to each release. A number of Linux applications are already providing Flatpak apps, and many more experimental builds are already in the works. The Flatpak website features a growing list of these applications.

One such application is LibreOffice. Michael Meeks, director of The Document Foundation (the non-profit organization behind LibreOffice), recently told Flatpak developers about the "horrible compromises" the organization was forced to make to achieve forward compatibility on Linux. LibreOffice was quick to start providing Flatpak builds of its office suite, which can be found at libreoffice.org/download/flatpak/.

Flatpak is an independent upstream project hosted on Github. It is standards-compliant, making use of the Open Container Initiative specification, a Linux Foundation initiative intended to enable compatibility between container technologies. Flatpak shares several technologies with other projects, such as the Bubblewrap utility and OSTree, and it makes ample use of Linux kernel features. Importantly, all of these technologies and features are commonly available for all Linux distributions.

Interestingly, the traditional Linux desktop is not the only target that Flatpak has in its sights. It can be used as the basis for custom solutions across a range of sectors, included embedded and in-vehicle infotainment. This is perhaps one reason why partners have been quick to engage. One early contributor is Endless Computers, which is making use of Flatpak for all its applications, both on Intel and ARM-based devices.

Collabora, a prominent open source consulting firm, is taking an active interest, particularly with regards to embedded and commercial applications, and one of their developers is already contributing patches. It isn’t hard to imagine how a generic solution for application distribution might be of interest to a variety of industries.

Challenges

Back in the world of Linux distributions, Flatpak does face challenges, and its success will depend on adoption. It certainly has the advantage of compatibility—the Flatpak team has designed a framework that doesn't require changes to the underlying distribution in order to work. For distributions, adoption is simply a matter of packaging Flatpak and making it available. These packages are already available in Debian Experimental, Fedora, and Mageia Cauldron, as well as through unofficial repositories for Arch, Gentoo, and Ubuntu. Once Flatpak is installed on a system, the Flatpak application collection becomes available instantly.

Whether Flatpak will be available by default in these distributions is another question. Only then will it be able to provide an effective out-of-the-box solution for software installation. Linux desktop environments, such as GNOME and KDE, are already working on Flatpak integration, and a fully Flatpak-capable app store—in the shape of GNOME’s “Software”—is just around the corner. Could this be the beginning of the universal app store for Linux?

Visit flatpak.org to learn more about Flatpak or to join the community.

About the author

Allan Day - Allan Day is a user experience designer working at Red Hat. He has been involved in open source for more than 10 years and is a member of the GNOME Foundation Board of Directors.