Context, one of my NixOS configurations did not define system.stateVersion
, so quite helpfully the warning message for nix-build
pointed me to this documentation: https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion (TIL the risks of not explicitly setting state.systemVersion
). I still have a few gaps in my understanding though…
I’m pinning nixpkgs
in my repository, so I must have falsely assumed that config.system.nixos.release
(which system.stateVersion
defaults to) would be pinned, but it seems like it isn’t.
Can someone help me understand why pinning nixpkgs
doesn’t help me here?
Where does config.system.nixos.release get defined?
You can see that it is defined in the same module in the Configuration Options appendix.
Pinning nixpkgs will make the default values of the options predictable – but that is not the issue. If you bump the pinned Nixpkgs, the stateVesion
could change without your knowing and break your system.
but that is not the issue. If you bump the pinned Nixpkgs, the stateVesion could change without your knowing and break your system.
In my case, I’m not sure this is what happened. I got two different configurations when running nix-build
on two different machines:
-
Machine A:
nix-build (Nix) 2.3.16
: used 21.11
-
Machine B:
nix-build (Nix) 2.8.1
: warned about defaulting to 22.11
(breaking changes)
I got different result without bumping nixpkgs
. It’s still unclear to me why my pinned nixpkgs
didn’t help me here.
Are you sure you have nixpkgs
pinned? What pinning method did you use and how are you rebuilding your systems?
Are you sure you have nixpkgs
pinned? What pinning method did you use
Pretty sure. I’m using niv
to pin nixos-unstable
, nixos-21.11
.
how are you rebuilding your systems?
nix-build /path/to/repo -A path.to.nixos.system