Developing applications using Flatpak-packaged editors/IDEs

So, this is a commonly asked question, and there is no full answer to it, but there are several options that, by themselves or as a combination, moves toward solving this.

The first option is the one chosen by gnome-builder. gnome-builder tightly integrates with flatpak and doesn’t actually build things in the context of the gnome-builder sandbox and its runtime, instead if recursively creates other sandboxes for builds. This means that you get to pick any runtime for your builds which may be completely different than the one that runs gnome-builder itself. This is quite powerful, but requires a lot of intimate support for this model in the IDE.

The second option is to extend the app/runtime via flatpak extensions. Flatpak already supports this in the Sdk, with the org.freedesktop.Sdk.Extension extension. Flathub currently hosts sdk extensions for mono, openjdk 8+9, rust and gcc 7 + 8. These are compilers that are not supported natively by the Sdk, but you can still use them.

Effectively what this mean is that if you install say org.freedesktop.Sdk.Extension.rust-stable and run something against the freedesktop sdk (or derivates) a directory will appear in /usr/lib/sdk/rust-stable/ that has the compiler and tools for rust. All you have to do is add it to PATH and then you can build some rust app.

It has been proposed to add a similar extension point for IDE-like tools so that you can easily add the tools you need to them. This would be done in a way that allows these extensions to be shared between different IDEs.

The third way is to use the dbus service that comes with flatpak to break out of the sandbox. This needs the app to have explicit permissions for this, but once you have this you can use the flatpak-spawn --host command in the sandbox to start commands on the host (or call the dbus directly which is what gnome-builder does when it spawns you a terminal on the host inside its window).

I think different problems call for different solution, but a combination of the above is pretty compelling.

3 Likes