diff options
author | Janne Heß <janne@hess.ooo> | 2021-05-24 16:08:40 +0200 |
---|---|---|
committer | Janne Heß <janne@hess.ooo> | 2022-05-05 12:22:31 +0200 |
commit | e2703d269756d27cff92ecb61c6da9d68ad8fdf8 (patch) | |
tree | 1ad2ddcff13f37107e228913076b0baee1621d71 /nixos | |
parent | 50609942614bc996e3d13771fa1513c54338ec94 (diff) | |
download | nixpkgs-e2703d269756d27cff92ecb61c6da9d68ad8fdf8.tar nixpkgs-e2703d269756d27cff92ecb61c6da9d68ad8fdf8.tar.gz nixpkgs-e2703d269756d27cff92ecb61c6da9d68ad8fdf8.tar.bz2 nixpkgs-e2703d269756d27cff92ecb61c6da9d68ad8fdf8.tar.lz nixpkgs-e2703d269756d27cff92ecb61c6da9d68ad8fdf8.tar.xz nixpkgs-e2703d269756d27cff92ecb61c6da9d68ad8fdf8.tar.zst nixpkgs-e2703d269756d27cff92ecb61c6da9d68ad8fdf8.zip |
nixos/version: Warn about using the default of system.stateVersion
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/misc/version.nix | 9 | ||||
-rw-r--r-- | nixos/modules/testing/test-instrumentation.nix | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 931201ade29..010acdb72f6 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -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 diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix index 81541477b9e..4ab2578eb81 100644 --- a/nixos/modules/testing/test-instrumentation.nix +++ b/nixos/modules/testing/test-instrumentation.nix @@ -129,6 +129,9 @@ in # Make sure we use the Guest Agent from the QEMU package for testing # to reduce the closure size required for the tests. services.qemuGuest.package = pkgs.qemu_test.ga; + + # Squelch warning about unset system.stateVersion + system.stateVersion = lib.mkDefault lib.trivial.release; }; } |