Gentoo to Guix System

02/24/2022

Last December, I volunteered to help run the Free Software Foundation's table at Ohio LinuxFest, and it was a great experience. I met a lot of professionals and excellent people who shared some of my passions. One thing I needed to do to be able to represent the FSF was to make sure any computer I was taking to the event was for the most part running Free Software- that is, that the laptop I brought with me was running a Free operating system.

When I was asked whether I could do this, I remembered I was still using a nonfree kernel on my laptop (the internal wifi card depended on iwlwifi), and it was running Gentoo GNU/Linux, which isn't FSF-endorsed because part of the project is maintaining nonfree software (packaging nonfree kernel bits, nonfree software packages etc). I knew my laptop really only depended on a nonfree wifi-card driver from a nonfree blob, but the FSF was happy to mail me an adapter that was usable with linux-libre. At this point, I installed Guix System on the free space on my drive, since I've heard good things about Guix's packaging philosophy. I was already a fan of Portage, because of the responsible way build options can be automated and streamlined, so I was interested in how Guix differed.

The first sign I was out of familiar water was the way Guix System handles what we would consider 'global configurations' like the contents of fstab or whatever system daemons we tell the init system to manage. The best way I can describe the philosophy of Guix is "functional" - the goal state is that you can provide an input to produce its associated output. When you use Guix System, you define your system in Scheme, and then guix system interprets the output and makes it to your spec. That is, you don't change fstab, you tell Guix how fstab should be. This is super cool, and it makes for reproducible systems, and easy rollbacks in case you make a breaking change. Also, since the only requirement for your operating system spec is that it has to be a valid operating-system type declaration, you can use whatever tricks you want up your sleeve to define it.

Traditionally for matters like this I usually either just remember how I had something set up and try my best to replicate it, or back-up the configurations themselves, although sometimes it can be dubious whether or not the package manager will manhandle my configurations if I tell it to do something. For example, Portage would often see my changes to inittab as something that needs to be overwritten and prompt me to during etc-update. With Guix, the state of inittab is defined when my operating system is generated, and it is immutable until I make a new operating-system. System configuration is so consolidated now that I just stick the whole thing on git for backup and tracking.

Package management with Guix has the same type of philosophy, since guix system, is just part of Guix. Packages are also defined functionally with the effect that if I hand you a definition for some package, you will be able to replicate it bit-for-bit. If sources are referenced with Git, you can cite the commit hash and give a checksum to ensure that you are using the exact same codebase that I am. I've found writing packages to be very easy and straightforward, despite my lacking sense for Scheme.

Guix also has other nuances that win me over, like profiles and its extreme flexibility by design. I ended up using it full-time instead of Gentoo GNU/Linux, and I've been enjoying the experience, so I'll be using it on my personal computers for the time being. It's a bonus that it's another excuse for me to learn some Lisps, and that's the real learning curve of using Guix system. The Guix paradigm diverges from how GNU systems are set-up, and so oftentimes doing an internet search for "linux how to do x" in the context of system administration doesn't fly. Learning how to do things the Guix Way can be daunting, but the documentation is well done for such a new project and after a while it 'makes sense' such that I can solve novel 'how can I produce x's by intuition, which is an indicator that something's being done right.


home | blog index | rss | contact me | PGP public key?