I’ve searched the manual, I employed a web search, but I couldn’t find documentation on how to upgrade NixOS 25.11 to NixOS 26.05. I remember from past NixOS upgrades that you shouldn’t just switch channels and then run nixos-rebuild; in particular you should upgrade Nix, the package manager, first. I don’t remember the details, though, and they might be different for upgrading to NixOS 26.05. I’m quite perplex that such important information like how to upgrade to the current NixOS version isn’t easily accessible. Where can it be found?
I’m curious where you’ve heard that you should upgrade just Nix by itself first, and then rebuild your configuration? Nixpkgs is explicitly written conservatively such that it’s compatible with a wide range of Nix implementations and their versions.
Except for all the renamed and otherwise changed module options, you should be good to change the channel and rebuild. Just read the release notes before doing so, and the rest should be caught at evaluation time (or, at worst, at activation time, at which point you roll back, fix the issues, and rebuild again).
Thanks a lot for the quick response.
I read it in the past in some NixOS documentation.
I’ve read about things like changes in Nix’s database format, which can cause incompatibilities.
“Should” isn’t a strong work. Can I rely on this working? I cannot afford making the computer in question unusable even for a day. Isn’t there any documentation that explicitly says how to upgrade to NixOS 26.05?
There’s plenty of people here who have already upgraded, and no database corruption was raised. Also, as someone who has been daily driving NixOS for close to 5 years now, I’ve never had any issues when updating my Nix version. Although I am personally on nixpkgs-unstable, so there’s that.
But this is exactly why we use NixOS, isn’t it? You can fearlessly roll back and have the system working as it was before attempting the upgrade. There’s no explicit instructions because the update procedure is the same - you read the changelog, and switch the channel. This is also what the manual says: NixOS Manual
Good to hear. I’m currently giving the upgrade a try.
That’s the theory, but there are also things like the warning in the Upgrading NixOS section:
[…] [N]ewer NixOS may also have a newer Nix version, which may involve an upgrade of Nix’s database schema. This cannot be undone easily, so in that case you will not be able to go back to your original channel.
I’m rather sure that when upgrading to 25.11 I did see some explicit upgrading instructions.
Well, it talks about “keeping the NixOS installation up to date”, which isn’t completely precise. I thought that it rather refers to upgrading within a NixOS version, like when fetching security updates.
Anyways, thanks a lot for your help. I’m currently optimistic that the upgrade will succeed. If you don’t hear from me again, then it’s because the upgrade has failed and I therefore cannot access this Discourse space anymore. ![]()
While that’s technically true, the store schema hasn’t changed in 10 years, and the last meaningful change was adding a new column, which in practice means you could go back to an even older Nix version and it would still accept that database1. The link I provided is also straight from the 26.05 release notes, so looks like there aren’t any specific upgrade instructions ![]()
This is also just a warning that downgrades aren’t always possible, not some recommendation to update nix independently from NixOS.
It’s possible that if you try to upgrade from NixOS 19 all the way to 26.05 without doing intermediates you run into a new builtin, and therefore need to upgrade nix first, but skipping that many versions is inadvisable in the first place, and it’ll just be an eval error.
Stepping NixOS releases one by one will almost certainly always be possible without any extra work. There is no policy that explicitly states that, but I doubt anyone would want to break this expectation. If it ever does happen, the release notes will tell you.
At the moment, nixpkgs is very conservative with nix version requirements, so you can usually get away with larger jumps, too, though not all modules (e.g. nextcloud) support that.
No such thing: Appendix B. Release Notes
Nor has there ever been to my memory in the last decade I’ve been doing upgrades.
I think you may have gotten confused with home-manager or nix-darwin stuff, which will talk about maintaining nix separately if you don’t use their nix.enable options.
In those cases you indeed have to manually upgrade nix, because the deployment tool isn’t managing your nix version. This has nothing to do with NixOS, though, and even then you should be able to upgrade nix whenever you feel like.
If you use those, I’d recommend just using the .enable options to prevent having to manage that state by hand though.
NixOS 26.05 is running now. ![]()
The upgrade was not completely smooth, though. After running sudo nixos-rebuild boot --upgrade, I ran sudo nix-store --verify --check-contents for good measure. During this or after (I wasn’t in the room when it happened), the GNOME desktop, which had been running, disappeared, and I was in an empty text console with just the cursor in the top-left corner. Console switching wasn’t possible, but luckily Ctrl + Alt + Del worked.
I haven’t, since I haven’t used either of them.
Maybe I had confused this with updating the Nix channel (what the --upgrade option to nixos-rebuild is for).
The requirement to update release wise, can be inferred from the regular deprecation/warn cycle.
You get one release with nudges, and then stuff will break.
But I agree, I’d love an official paragraph about this circumstance in the upgrade guide.