Note: Fedora Atomic Workstation has recently been renamed to Team Silverblue. Learn more here.
Last time, I wrote about using flatpak-builder to do commandline development in a container (namely, in a flatpak sandbox). Flatpak-builder is a pretty versatile and well-documented tool.
Of course, it works well to build desktop apps that already have a flatpak manifest in their git tree. But I have also used it successfully to build and run anything from a library to a session service.
For this reason, I suggested that we should add it to the default Fedora Workstation installation – it is a nice tool to have around. When the Workstation SIG discussed this idea, it was rightly pointed out that there are quite a few dependencies that flatpak-builder pulls in: git, bzr, svn, meson, autotools, … Not surprising for a meta-build-tool that supports diverse source control and build systems. But it does make the default install quite a bit heavier.
Maybe some of this can be fixed by turning ‘fringe’ dependencies like svn or bzr into Recommends and make flatpak-builder handle the lack these tools gracefully. But there’s an easier solution here: Just use flatpak! It may not be the premier use case it is designed for, but flatpak can handle commandline apps just fine.
So we created a flatpak for flatpak-builder today, and made it available on flathub. You can get it with:
flatpak install flathub org.flatpak.Builder
As I’ve explained in an earlier post, you can get the familiar command name back by setting up a shell alias:
PATH=$PATH:$HOME/.local/share/flatpak/bin alias flatpak-builder=org.flatpak.Builder
And, voilá, flatpak-builder works as before! And all its dependencies are in the runtime that it uses (in this case, an SDK). My host system can stay lean and clean, as I like it.
At first I was surprised by this use of flatpak, but then I learned that there are already a few non-graphical applications on flathub. For example, you can install glxinfo from there (under the name org.freedesktop.GlxInfo), and vim is also available on flathub.
I suspect that we might see more commandline tools become available in this form in the future.
“I suspect that we might see more commandline tools become available in this form in the future.”
I really hope so. Some CLI tools iterate pretty rapidly: the most important of these include the tools from cloud providers. These aren’t things that are tied to a specific development project, so containerizing them feels awkward.
At this point, Homebrew is pretty much the critical app for my use of macOS, because it lets me have the latest CLI tools, particularly the AWS and Heroku CLI clients. Snap support CLI tools as well: there’s actually a pull-quote from a Heroku engineer on the front page of the Snapcraft Website, specifically talking about the usefulness of snaps for delivering the latest Heroku CLI releases.