NixOS Specialisations - How do you use them?

Another rough edge: when you nixos-rebuild ... switch the system, it switches back to the “parent” configuration instead of the current “specialisation”. Considering the implementation, it’s not surprising, but it’s not the best UX (and could potentially be very disruptive… especially if display-manager disappears from underneath you…).

Poking around, I think the specialisation module actually reaches into some boot.loader.grub.configurationName option, so if you use systemd-boot, and don’t specify this per-specialisation, it winds up being unset.

I think instead, maybe, it should be inferred from the key in the specialisation option. Then, it would be guaranteed to be available in /run/current-system/configuration-name and then a smarter script can know the current active specialisation and could switch into the built specialisation with the same name.

2 Likes