Making the most out of distrobox and toolbx

While moving to an image based operating system has been a gamechanger for me it's important to remember that if it's doing it's job it's invisible.

My graphical applications are already handled by Flatpak, so I thought I would take some time investing in modernizing my command line workflow.

Toolbx and Distrobox have made it possible to transparently run our command line interfaces in an OCI container. This makes it really easy to keep our customization and work environment seperate from the host so that we keep that nice and clean.

First things first, let's take care of config, what is commonly referred to as dotfiles. Things like your .bashrc, vim.rc, etc. Tools like Stow have been around for years, and it's not uncommon for advanced users to keep their dotfiles in GitHub so that you can bootstrap a new machine.

Here's a video overview of my setup

However, tools like this have been around a long time, before Distroboxes even existed. What if I could meld them together to form my new CLI experience?

Conceptually I wanted to keep my dotfiles managed, but also ensure that my terminal image has all the goodies I need. Thus began my journey to make an image that would act as a bootstrapper for chezmoi, a tool that is used to manage your dotfiles. This would allow me to keep the config and the image logically seperate, while having both things live in git, and then use GitHub's actions to generate and sign an image for me. From now on my entire terminal will just live in GitHub forever.

I call it boxkit,  check it out here:

GitHub - ublue-os/boxkit: A blingier starting image for Toolbx and Distrobox.
A blingier starting image for Toolbx and Distrobox. - GitHub - ublue-os/boxkit: A blingier starting image for Toolbx and Distrobox.

You can try it right now by doing a distrobox create -i -n boxkit  and then distrobox enter boxkit. I've got my terminals set up to just enter it automatically so that it's transparent to me, I'm always living in it.

I then do a chezmoi init castrojo/homies to grab my dotfiles and that's it. I've got all my stuff on my machine, and chezmoi supports bidirectional git syncing of those files, as well as password manager integration to manage my secrets.

Making your Own!

I've chosen to build my CLI experience on top of alpine, chezmoi, and just. My image includes those tools so they're always there. Whatever tools you use can be adapted to this. Use whatever distro you want and whatever tools you want.

The neat thing that toolbx and distrobox have enabled for us is that it doesn't just have to be "shove your dotfiles in git", you can stick the whole experience in there with the tools that you want right on an image and combo the whole thing together. Keep it lean and mean and minimalist, or go full hog with the entire universe, thanks to the logical separation that we get from containers your host OS will stay clean.

I go into more detail in this companion video.

Adding it all together

I've been going on and on about a cloud native linux desktop model for over a year now and it's all coming together. I've got my host OS and working environments all managed automatically via GitHub. These are built regularly and published to the GitHub Container Registry.

All of my machines run off of these images, removing all client-side packaging entropy. And since GitHub gives me 90 days of free container hosting I have 90 daily snapshots of my OS that I can rollback to. Same with my distrobox image. I only backup my home directory because everything else is reproducible. This is the way.

And the best part is you can do all this by using common tools like Dockerfiles, podman/docker, git, and your favorite distro's cloud images. Now it's up to us to continue to push automating and working on the tooling to make the user experience better, so dive in and give it a shot!

Show Comments