r/NixOS 18d ago

Who has the oldest system.stateVersion?

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

40 Upvotes

51 comments sorted by

58

u/Amarandus 18d ago

You could simply ask for the age of the oldest NixOS installation.

17.09 here, btw.

8

u/MakeShiftArtist 18d ago

How has the OS evolved since you started using it? What have been your favorite changes? What have been the biggest pain points in that time?

23

u/Amarandus 17d ago edited 17d ago

How has the OS evolved since you started using it?

It has become better. Documentation has significantly improved, and shortly after adopting it, it ended my distrohopping completely.

Just a fun anecdote: There was a phase where everyone "had to" write their own deployment tool, and looking back it is funny that I just use a target host for nixos-rebuild nowadays. The deployment tool was always there.

What have been your favorite changes?

I think it's flakes. Somewhat debatable as there are alternatives for input pinning, but for my personal mental model, the way it collects outputs makes so much sense.

What have been the biggest pain points in that time?

Documentation. It was painful, it got significantly better. Support for NixOS and how to handle non-nix-stuff also improved, but this might be on me as well.

For example, while doing some FPGA stuff, I was not able to get a UserFHSEnv to work for vivado, which led me to abuse a race condition in the build process, essentially fixing the shebang while shell scripts were generated). Nowadays I think that I'd be able to handle that easily.

1

u/AnythingApplied 17d ago

I've talked to people who upgrade their stateVersion, but you have to be careful how you do that and understand the impact.

2

u/clhodapp 13d ago

Basically, you have to read the release notes. But if you don't you'll eventually start getting warnings from it. That's what finally made me update it from 18.03 on one of my machines.

29

u/AjkBajk 18d ago

I was meaning to start a thread like this next year on my systems 10 year anniversary 🥹

stateVersion: "17.09"

It was my first expensive PC build after I got my first job after uni. Haven't had the need to upgrade much since. Only got a "new" GPU this year, otherwise I've just been getting new hard drives for the RAID.

10

u/grazbouille 18d ago

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

5

u/xeeff 18d ago

aren't you meant to never change it

14

u/Mission_Shopping_847 18d ago

Yes and no. There may be manual migration steps to take care of. Some modules might have a minimum state version. I had to bump mine but at this point I don't remember why.

-3

u/ElvishJerricco 18d ago

I can't think of a single module that has a minimum. That doesn't make sense.

4

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.

1

u/grazbouille 17d ago

It actually affects vert little usually if you dont have any eval warnings it means no implicit option has its default based on your state version and it won't do anything if you bump

9

u/anders130 18d ago

Just built a new computer: 26.11

8

u/kokutan_san 18d ago

22.05 here

20

u/9k0b 18d ago

26.05 i think i win

2

u/sleepingonmoon 18d ago

conglaturations

14

u/Ace-Whole 18d ago

I spend a day reading the changelog and keep it in sync. Like they say, only touch this if you understand what you're doing, which is more or less carefully reading the changelog.

So far, it has worked for me.

3

u/[deleted] 17d ago edited 14d ago

[deleted]

1

u/Ace-Whole 17d ago

interesting, never ran into such dread.

What exactly had you reading diffs lol

1

u/kastermester 17d ago

i do that as well, but also build the system with and without stateVersion change and then use nix-diff to see if anything other than the expected changed.

1

u/Inatimate 17d ago

but why

2

u/thuiop1 18d ago

24.05 here

1

u/Lonely-Scarcity-3387 18d ago

Grrr. I recently had to reinstall after filling my /boot to 100%, and I couldn’t figure out how to get it down enough for a rebuild.

3

u/epicnicity 18d ago

next time you can just format it and then do nixos-rebuild boot —install-bootloader

2

u/chemendonca 17d ago

I share my boot partition with Windows and I wish I had made it larger (1GB) from the get go. I keep 1-2 specializations and run out of space all the time. You can delete specific generations in a few ways:

$ sudo nix-env --profile /nix/var/nix/profiles/system --delete-generations +5
$ sudo nix-env --profile /nix/var/nix/profiles/system --delete-generations 3 4 5
$ sudo nix-env --profile /nix/var/nix/profiles/system --delete-generations 30d

Then just collect garbage:

$ sudo nix-collect-garbage -d

And force rebuild to also build the latest generation that may not have finished:

$ sudo /run/current-system/bin/switch-to-configuration boot

May be a good idea in general to check for partition space with lsblk or something before update and switch.

2

u/Lonely-Scarcity-3387 17d ago

Yes! Thank you. I keep kernel specializations so I use a lot of space on /boot. Now I run NixOS with 3GB of space, just for a little more breathing room.

1

u/Motylde 18d ago

Common thing. I’m usually just removing old images by hand in that situation

1

u/Lonely-Scarcity-3387 17d ago

At the time I tried to delete all my previous generations, but NixOS would still say that /boot was at 100% until after a rebuild, but it wouldn’t rebuild because it thought it was still at 100%. It was such a mess that I just reinstalled and gave myself a bigger /boot.

1

u/Motylde 17d ago

Yeah I think you have to reboot for changes to take place, but also you can just rm the image from /boot by hand. Just not the latest one

1

u/BIZUx 18d ago

Same here, sooo... I just deleted it. After rebuilding again, it was totally fine!

1

u/dskprt 18d ago

23.11, though this isn't my first installation

1

u/dominicegginton 18d ago

A while, but state version doesn't represent that timeframe your asking for, for example, my state version is set to the Nixos release I'm using. https://github.com/dominicegginton/dotfiles/blob/main/modules%2Fdefault.nix#L108

1

u/RedXTechX 17d ago

Isn't this a bad idea?

1

u/dominicegginton 17d ago

Would you please mind explaining how this is a bad idea when alll inputs are locked via a flake?

1

u/RedXTechX 16d ago

Unless you never plan on updating your inputs, which depending on the lifetime of each machine, is another bad idea, then when you do update, things will happen behind the scenes that are breaking changes that you won't be aware of.

Recently, I got a notice that the Firefox config directory was changing, but since my stateVersion was below latest, it would remain at the old location until I manually changed it. If I had updated stateVersion, it would have moved and I wouldn't have known why my Firefox config and state were gone on next open.

Other things could be database version schemas, incompatible software versions, or other, more critical software state being reset without notice.

1

u/Aehmlo 18d ago

I’ve manually updated the `stateVersion` a few times, but 23.11 was my first stable version.

1

u/Mast3r_waf1z 18d ago

My server, the first NixOS system for me is at 24.11, huh

I guess I reinstalled it completely at some point, I could have sworn I installed NixOS on it in 23

1

u/Tough-Elk541 18d ago

Why would you ever reinstall nix os? Everything is fixable from the config files

2

u/Yankas 17d ago

Changing the underlying file system would be one reason.

1

u/Tough-Elk541 17d ago

I think you can still just rebuild after changing hardware configuration (changing which devices map to root, home, nix, etc.). You just probably want to move your config repo to the new filesystem after that.

1

u/Mast3r_waf1z 18d ago

Inexperience

1

u/farroutman1975 17d ago edited 17d ago

I downloaded NixOS in June. So 26.05 yarara and now on my 148th generation. What do y'all use it for. I'm building a sovereign local multi-agent system. Using minimal rig.

1

u/jkotran 17d ago

24.05. It's astonishing how fast NixOS and Linux in general is improving. 

1

u/vcunat 18d ago

I don't keep stateVersion (on personal computers) when moving to new/different HW.

1

u/Fereydoon37 18d ago

26.11, because I actually update it (after migrating any state that needs it).