I’ve been curious about NixOS and thinking of trying it out on a laptop (currently running an Ubuntu LTS release) that usually is in the closet and is usually only updated before I travel with it – which isn’t frequent, usually around fall or winter holidays.
(FWIW, my desktop, which I use and update a lot more frequently, currently runs Arch.)
Can I get away with having long stretches of time between updates without worrying too much about breakage?
Long stretches of time are irrelevant to breakages. Nix, unlike other package managers, doesn’t have to find a sequence of actions which bridge the gap between the current state and the desired state, it just creates the new state “from scratch” with each rebuild, so it doesn’t suffer from “dependency hell”. Of course, the security implications of not updating have to be considered carefully.
I should, however, clarify that nixos options and nixpkgs packages change. Sometimes they’re moved to a new name or reimplemented in a different manner, things like that. Normally, warnings are left behind so that eval errors tell you what you need to change in your config in order to move forward, but those warnings are removed after some amount of time… roughly a year, if memory serves. It isn’t dependency hell, but the smoothness of an upgrade does decrease significantly if you wait long enough. That said, you can always do the update in steps through the intervening 6-month major releases if you want to. Certainly an update with the new release every 6 months should work fine.
These are good answers, and the separation of two concerns with regard to upgrades is valid:
missing fixes for vulnerabilities, the usual concern but not really relevant while the laptop is unused assuming it will be updated before being used again
config drift issues that may emerge in the process of updating, described above.
I’ll add to the latter, though, by making some assumptions:
you have an/other machine/s that you use more regularly through the rest of the year
the laptop is essentially unused during the rest of the year, so is a viable test system to try out nixos without impact to normal work
you’re comfortable doing this trial, and if the trial is unsatisfactory, you can go back to what you had before on the laptop easily (reinstall, restore an image backup, whatever your preference)
jumping ahead, the trial is successful and you migrate to nixos on your regular machine too
At that point, most of the concerns around jumping the gap over intermediate versions (like adapting small bits of config) also go away, because you deal with them once in a shared config, and you can build the laptop’s config regularly even if it’s never deployed while the hardware is in the bottom of the drawer.
The next time the hardware boots, you can just apply the current build. It can even autoupgrade if just left running a while before use.
I have a number of machines like this, that are used rarely, or dual-boot into another OS most of the time, and I don’t really worry about upgrade issues for them at all.
Also to add, this inherently involves a discussion of stable/unstable (and versioned vs rolling releases).
NixOS is ultimately a versioned distro, with similar guarantees to Ubuntu/Debian/Fedora (release cadence of 6 months, so much more frequent breakage than ubuntu LTS, about on par with Fedora, but much less frequent than Arch).
There is a large sub-community of users using the unversioned development branch directly, which effectively means treating NixOS as a rolling release distro. This works pretty well in practice, but breakage does occur if you use it like this. You don’t need to join those folks though.
We generally refer to the latter as “unstable” vs the “stable” NixOS, since the development branch is called nixos-unstable.
On stable you can get away with ignoring updates for 6 month stretches pretty comfortably (indeed assuming the system isn’t running and you therefore don’t need security updates), and whenever you then do need to update to a new version the release notes, and hopefully - but not always - carefully written warnings and error messages, are there to get you through that.
If you do end up needing a random newer package while using stable, which is often the gateway drug to rolling release distros, NixOS is much better at allowing limited use of unstable packages than other distros.
There are limitations to this, but the nix guarantees (libraries are duplicated instead of potentially swapped out with incompatible versions) make breaking your whole system by installing a random newer package almost impossible (unless you, say, wish to update systemd or something else deeply integrated and inter-connected besides the link level). Even if you do end up breaking your system this way, generation rollbacks are trivial and let you actually experiment with these kinds of things without then having to reinstall because your package manager no longer works since you tried to swap out python 3.4 for python 3.7 or whatever… Have had to tell many an inexperienced coworker to reinstall debian after franken-debianing themselves.
Yeah, that’s what I gathered from researching NixOS. My impression was that nixos-unstable was more like Debian sid or Arch’s testing repos, rather than like Arch’s main repos.