NixOS Specialisations - How do you use them?

I recently learned about specialisation too: I saw a PR in nixpkgs from someone who too rediscovered the feature and renamed it. The orignal name “nesting” was so criptic probably only a couple people knew about it.

Anyway, I have two specialisations. The first is for when I connect my computer to a tv: it sets up autologin for my user, enables wifi, sets default audio output to HDMI and starts the controller daemon. The other is similar but without the autologin, which I use when travelling but I have access to a keyboard.

I use system.nixos.tags to tag each one with same name as of specialisation.<name>, so they appear in grub menu and I can switch at boot. Btw, grub now has pasword support in NixOS so the autologin completely isn’t insecure.

7 Likes