I thought I’d document my experience with NixOS as a new user. This is kind of a mini review and my first impressions.
As some background, I’ve been using Arch for about 10 years, I’ve used Mint and Fedora as daily drivers in the past and played around with Ubuntu, Gentoo and various other distros over the years. I’m not a new Linux user but never used NixOS. I’m very familiar with creating docker images and I have some experience with creating customised Arch PKGBUILD files though I’m not a maintainer so probably know just enough to be dangerous.
Day 1:
Grabbed the installer, wrote the ISO. For some reason the usb drive I was using didn’t boot in UEFI mode, swapped to another one and it worked as intended :shrug:.
I used the graphical installer as I wanted to go down the recommended path for installation. I was surprised that the installer didn’t give any filesystem options, it felt like a glaring omission but installed it using the installer and booted the OS. I didn’t expect ZFS or anything exotic to be an option but thought I’d at least be able to choose between ext4 and btrfs.
Installed, rebooted and it all worked fine, had a quick look around and explored the configuration.nix.
file. But I’d previously read about impermanence (one of the things that drew me to nixos in the first place) so looked into how that worked. In addition I wanted disk encryption. Another feature that the installer surprisingly also doesn’t have an option for.
Firstly I wanted to see if I could get disk encryption and ZFS working. I followed the guide here: NixOS Root on ZFS — OpenZFS documentation
I can use cryptsetup to open the disk with a passphrase in the live usb but whatever I try, NixOS never asks me for the passphrase on boot after installation. It times out trying to mount the partition (obviously, it can’t see it until cryptsetup has opened the disk). It’s clearly not a ZFS issue, NixOS isn’t even aware it’s a ZFS partition until it’s opened with cryptsetup open
. I tried various things suggested on the forum, including specifing the device using /dev/disk/by-id
, /dev/disk/by-uuid
, /dev/disk/by-partuuid
etc. After about an hour of tinkering I gave up.
I tried again using ZFS encryption instead of luks2 as per this gist How I installed Encrypted ZFS root on NixOS · GitHub and Nix asks for the passphrase on boot first time. Not really sure of the pros/cons of this as I’ve only ever used luks2 in the past. I’ll leave it for now and investigate again later.
Installation 3, now I know I can get disk encryption and ZFS working I wanted to test out an impermanence configuration. I very easily got impermenance set up quickly using a mix of Erase your darlings: immutable infrastructure for mutable systems - Graham Christensen and NixOS ❄: tmpfs as home - Elis Hirwing and NixOS ❄: tmpfs as root - Elis Hirwing.
I took a hybrid approach where I’m using a ZFS partition for /nix
and /nix/persist
so I can leverage snapshots, mirroring and other nice ZFS features but using tmpfs for /
and /home
rather than reverting to a blank snapshot on boot. Still using ZFS encryption for now.
Day 1 - Initial Thoughts/Opinions
Having used both the graphical installer and the nixos-generate-config
+ nix-install
commands, I strongly think that the graphical installer should say something like:
This installer is intended to make the installation process as simple as possible with minimal customisation.
If you’re familiar with manually creating partitions and linux in general, you may prefer to use the command line installer
nix-install
is the easiest installer I’ve ever used. And doing it that way introduces the user to the configuration.nix
file at the installation stage. In my opinion the GUI installer just gets in the way and is quite restrictive. Though I realise I am coming at this from the perspective of someone used to manually installing arch via the cli installer.
Nix’s declarative build system and immutable filesystem approach is surely the future of Linux. It’s a breath of fresh air for anyone who likes a clean and tidy system.
Impermanence, and how delightfully easy it is to set up, is definitely a killer feature here in my opinion. No more cluttered .local
, .config
and dozens of dotfiles in my home directory that I’m not sure if I need or not!
I wish I’d tried out Nix earlier! I’ll be using it as my daily driver at home to see how I get on.
The only annoyance I had was being unable to get luks2 to work, it wasn’t at all clear why it never asked for the password during boot.