Adventures in NixOS
So I recently learned about NixOS. A lot has been written about the philosophical underpinnings of its “purely functional package manager” Nix; I’m more interested in the practical aspects, in particular the combination of one central (version-controllable) location to define the entire system with fast, painless rollbacks to any previous configuration. I’m already using Ansible, which kind of gets me the first of these, but not really; the actual state of the system is defined by the ansible configuration + whatever changes have accumulated to things that ansible doesn’t touch as packages get upgraded and tweaks get made that I forget to add to ansible. In contrast, in Nix most of the system (in particular, most of /etc) is read-only; you must make edits to /etc/nixos/
in order to change the configuration of the rest of the system.
How this works under the hood is pretty alien to me and requires some hoop-jumping to get some things (especially closed-source stuff) working right; fortunately, most of these hoops have already been jumped by the Nix community and made available as packages or as system configuration options. (And speaking of the Nix community, I’ve found the #nixos
IRC channel to be extremely friendly and helpful!)
I’d been wanting to try Nix for a little while, and have even been tinkering with it on a testbed server with eye towards migrating Ancilla to it, but following some surgery on my laptop Thoth (installing a new SSD as a replacement for one that died unexpectedly) I decided that this was a good opportunity to get a bit more hands-on with it. And if it went horribly wrong, well, the current OS was installed on a USB thumbdrive, it wouldn’t be affected.
I’m not going to go any further into the philosophy behind Nix or the technical details of how the package manager works; this is more of a chronicle of how installing Nix on my laptop went and what pitfalls I encountered in doing so. (Indeed, this will probably focus more on the pitfalls than on anything else, in the hopes of guiding other people – or Future Me, repeating this on another system a year hence – around them.)
I’m going to be splitting this into a bunch of different posts (and probably adding to it over time).