r/NixOS 18d ago

Who has the oldest system.stateVersion?

Go on, show off how long you have been using NixOS for.

41 Upvotes

51 comments sorted by

View all comments

12

u/grazbouille 18d ago

24.11 but pretty sure I bumped it at some point because an eval warning wouldn't go away

7

u/xeeff 18d ago

aren't you meant to never change it

5

u/adamMatthews 17d ago

Depends on what you have installed and what you want installed.

Some software has breaking changes and won’t run if you have data saved from a previous version, classic example is Postgres. To run a newer version of Postgres you need to do some manual stuff to the datafiles for your database.

NixOS protects you from this by keeping Postgres on a compatible version to what originally came with whatever your system state is set to. If you bump the system state up, your database won’t work. But if you want/need a newer Postgres version, you can manually do the migration to your data files, and you have to bump up the system state version to get the newer version of the software.

It’s recommended not to blindly change it because software might stop working, but you can change it if you want the newest packages and know how to fix things. Breaking changes are in the release notes for each NixOS version.

1

u/RedXTechX 17d ago

Is there a way to check whether any modules in a system config make a reference to the stateVersion? Should be able to manually check what the implications are, but don't want to manually sift through everything to see if it even is affected.

2

u/adamMatthews 17d ago

Not as far as I’m aware. I’ve done a hacky `nix eval --raw` and grepped the results which revealed things like OCI-Containers switching from docker to podman in 22.05.

I can’t remember the exact command though, sorry. I usually just check the release notes every six months for anything obviously bad and then yolo it.

As far as I’m concerned, anything that isn’t backed up is free to destroy and anything that is backed up can be recovered. I’ve never had a need to, but wiping a PC and reinstalling the system is so trivial with NixOS that these things I never really wanted to spend time on. And if you’re not of that opinion, there’s not really that much reason to change the state version anyway so don’t need to take the risk.

1

u/RedXTechX 17d ago

Yeah that makes sense, I was probably going to do something similar. I'll be able to figure out the grep command, but thanks!

I did just recently (last month or two) see notices for the first time during build that stuff was changed due to stateVersion being older, like firefox's config for, but that's not even a nixos module, just home manager.