NixOS

GitHub repo for my NixOS config can be found here

About a year ago I took a brief look at a Linux distribution called NixOS. NixOS falls under the category of immutable Linux distros meaning that the operating system is mounted as read-only allowing for more separation between the OS and packages. This is advantageous in many ways, some of which I'll get into below.

NixOS is based on the Nix package manager and it's principles. It works by declaratively configuring the entire operating system. This means that everything from the boot loader to system services to user management can be run out of a config file located in /etc/nixos/configuration.nix. In nerd speak you could say the basic idea is to have "one config to rule them all". Some of the reasons for my interest in NixOS include:

  1. Reproducibility. Having this one (or multiple smaller) config files allows for easier deployment of servers and workstations. For example, write a config once for a webserver and have an easy deployment the next time you need to deploy one. In my head I'm thinking docker-compose but on an OS level.
  2. Tinkering. I used to distro hop a ton, which is to say that I used to bounce around between desktop environments and package managers basically. These days I stick to Gnome for my DE, but if I wanted to see what things are like on the KDE side of things in NixOS it's an easy switch. Just change one or two lines of config and I'm up and running with a new DE. Very cool stuff. Add on top of that the ability to have snapshots of config changes and build a VM replica of your system after changes and how could a tinkerer not love NixOS?
  3. Easy Package Management. The Nix package manager avoids any dependency issues by utilizing the nix store located in /nix/store/ and giving each package a subdirectory that captures the dependencies. No need to worry about having conflicting dependencies. The Nix package manager also has an impressive amount of software. Take a look here.

Recently I've gotten the itch to take a look at NixOS again. I think there's a fair argument to be made that the future of Linux is heading in some kind of direction like NixOS. Plus it's fun to play DevOps from time-to-time and mess around with different deployments, configuration and development pipelines. With Nix, you've just got the one tool!

I think the reason I didn't stick with Nix the first time was twofold. First, I tried too many new things at once. I installed qtile on the box and was trying to get it configured as well as NixOS and keep track of it all and it got to be too much. Second, Nix (any by that I mean the package manager and language) is a lot to learn. You can follow my bumbling around in this distro in my GitHub repo located here.

Resources

Zero to Nix
An unofficial, opinionated, gentle introduction to Nix
NixOS 22.11 manual
Welcome to nix.dev — nix.dev documentation
Opinionated guides to getting things done in the Nix ecosystem.
Follow Me on Mastodon! Follow Me on Twitter