Warning: system.stateVersion is not set

trace: warning: system.stateVersion is not set, defaulting to 22.11. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.

But I do set it.
I even tried it with:

system.stateVersion = lib.mkForce "22.05";
home.stateVersion = config.system.stateVersion;

When I immediately rerun it, it doesn’t show the warning.
I’ve been seeing this for a few weeks.

OS: NixOS 22.11 (Raccoon) x86_64 
nix (Nix) 2.8.1
with home-manager
Kernel: 5.17.11 
Packages: 1137 (nix-system), 1002 
nixpkgs unstable

Do you have any NixOS containers configured? Recently the warning was extended to trigger for those as well.


How to get rid of the warning? Do I need to set stateVersion in the container configs as well?

To answer my own question: Yea, that seems to be the case.