Remember to Update Nix

I dabble in Nix. Meaning: I have a multi-user installation on my Debian-based workstation and I have NixOS installed on my laptop. I mainly use it to get more up-to-date builds of packages and to manage development shells. I have half-hearted home manager configurations on each machine but I've never really fully committed to building a single module that can manage both systems like some people have.

In general, Nix is great and I've found it to be very reliable. At some point I will work up the courage to replace my long-maintained Debian install with NixOS. But like I said, I dabble and so every time I need to do something more complex than adding a new package to my configuration it can take me a few tries.

This time, the more complex operation was was updating my workstation's Home Manager configuration to the 25.11 release from 25.05. I had already updated my laptop and that went smoothly. So I updated the nixpkgs URL in my Home Manager configuration flake, updated the flake lock and then ran the switch command. Gigs of packages downloaded but during evaluation I was greeted with an error similar to the following (unfortunately, I didn't think to save it off):

/nix/store/<some id>-setup.sh:2: no such file or directory: /setup

I flailed around a bit trying to understand what was going on. Was this a bug or an issue with the version of the package? Was there some further changes I needed to make to my configuration? I tried commenting out that package and moving on but just hit the same error with another. At some point the thought occurred to me to update the nix version so I ran nix upgrade-nix but I still received that error. I ended up reverting the nixpkgs version back to 25.05 and that still worked fine, so I put it aside for a while.

A few weeks later I came back to the problem and flailed a bit more but with the same result. Finally, it dawned on me that I had a multi-user installation of Nix. So I switched to root and saw that the system version of nix was quite out of date. I updated the nixpkgs channel for root and then upgraded nix with the following (still as root):

nix upgrade-nix
systemctl daemon-reload
systemctl restart nix-daemon

Note, that's not quite the procedure in the documentation, but it solved the problem regardless.

In the end, the thing to remember is: If you have a multi-user Nix installation, don't forget to keep it up-to-date.