Is it possible to create a snapcraft package of flatpak?

In PRs like Default to text auth on WSL by linghengqian · Pull Request #6491 · flatpak/flatpak · GitHub , members of the Flatpak community argue that changes to Flatpak often take years to reach Ubuntu users who install Flatpak via apt. This is because the changes first need to be packaged on Debian before they can be implemented on Ubuntu.

This raises a peculiar question: is it possible to create a Snapcraft package of Flatpak, and still install applications on Flathub using this method? I’m not sure if Snapcraft allows apps with such high permissions to be listed on the snap-store. I’m assuming the operation is similar to this.

sudo snap install flatpak --classic
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install flathub com.obsproject.Studio
flatpak run com.obsproject.Studio

However, I can’t figure out how to integrate gnome-software-plugin-flatpak in this situation.

With –classic confinement, I think there’s a high chance of achieving the goal.

The problem is, flatpak doesn’t seem to be in the allowed classic snap categories.

see: https://snapcraft.io/docs/reviewing-classic-confinement-snaps

how to integrate gnome-software-plugin-flatpak

I downloaded the deb and unpack it , it’s a simple .so share library, so the path for flatpak binary maybe a fixed value, probally need to patch the source and rebuilt it for the snap.

https://gitlab.gnome.org/GNOME/gnome-software/-/tree/main/plugins/flatpak

You probably couldn’t because you’d struggle to keep the ABI compatibility unless gnome-software was also made into a snap (the original snap-store snap - though this never had the Flatpak plugin in the snap version due to sandboxing); and then versioned explicitly to work together or gnome-software ending up part of the hypothetical flatpak snap.

The thing is, personally I’m not sure how much the flatpak binary alone would contribute, because there’s other components like the XDG desktop portals that help both snap and flatpak massively, and even though snap can keep snapd up to date, it can’t keep the portals installed via Apt up to date. There used to be a PPA that covered flatpak xdg-desktop-portals and a few others up to date but at some point the Flathub website stopped promoting it. I think a part of that was partially linked to build system changes that weren’t easy to backport and Flatpak itself gained some better handling around e.g., handling permissions that are newer than the binary supports.

Or e.g., there’s currently some bugs in interaction between Wayland apps & the Yaru mouse theme in the most recent Gnome Flatpak runtimes that exist on Ubuntu 24.04 because it uses Gnome 46 not Gnome 48 with some modern Wayland magic, you can see how the scope continues to grow depending how comprehensive you want that overall integration to be. Some of the responses I’d seen on that one in particular basically suggested that’s Ubuntu’s fault for having LTS releases to begin with.

So on the one hand I’m personally here like I’d love this to exist in theory, but the practise might not end up being much better than the current status quo even if it did exist. But it does create an interesting hypothetical where an Ubuntu Core desktop could do better than the default distribution, because things like Gnome Shell or the Portals suddenly would be within snapd’s control technically.

2 Likes