0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

nixos/version: Warn about using the default of system.stateVersion

This commit is contained in:
Janne Heß 2021-05-24 16:08:40 +02:00
parent 5060994261
commit e2703d2697
No known key found for this signature in database
GPG key ID: 69165158F05265DF
2 changed files with 12 additions and 0 deletions

View file

@ -146,6 +146,15 @@ in
"/etc/os-release".source = initrdRelease;
"/etc/initrd-release".source = initrdRelease;
};
# We have to use `warnings` because when warning in the default of the option
# the warning would also be shown when building the manual since the manual
# has to evaluate the default.
#
# TODO Remove this and drop the default of the option so people are forced to set it.
# Doing this also means fixing the comment in nixos/modules/testing/test-instrumentation.nix
warnings = lib.optional (options.system.stateVersion.highestPrio == (lib.mkOptionDefault { }).priority)
"system.stateVersion is not set, defaulting to ${config.system.stateVersion}. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.";
};
# uses version info nixpkgs, which requires a full nixpkgs path