NixOS persistently attempting to download 'nixos-rebuild dry-build --upgrade' output when running 'nixos-rebuild switch'

Hello, when I wanted to change and build some settings in my nix config (nixos-rebuild switch) I was present with NixOS trying to upgrade my system with the output from a ‘nixos-rebuild dry-build --upgrade’ that I performed a day ago. I don’t know if I’m just confused but I though that by running a dry build it would not actually change anything when building normally? Does anyone know how I can stop NixOS trying to download this big update every-time I try to rebuild my system? I am currently running NixOS 23.11, ‘nix-collect-garbage’ and ‘nix-store --optimise’ have not worked.

Skimming the source, and checking a guess – it seems like --upgrade and dry-build don’t know about each other. I think that command upgraded your nixpkgs channel. That explains why you’re now facing that big download/rebuild despite the dry-build invocation.

Unfortunately, I don’t really know how to downgrade channels; this is another reason I use flakes.

‘nix-collect-garbage’ and ‘nix-store --optimise’ have not worked.

this seems unrelated, but more detail beyond “have not worked” would be helpful. EDIT: Oh, I’m guessing you mean they didn’t help your problem. That would be expected. Those just clean un-used store paths.

I think you’re looking for nix-channel --rollback. Or maybe sudo nix-channel --rollback depending on things. Also, a great time to checkout flakes where this would be been (1) immediately noticeable (2) trivially fixable.

1 Like

Thanks for the detailed response! sudo nix-channel --rollback worked, much appreciated!