diff options
Diffstat (limited to 'nixos/modules/misc')
-rw-r--r-- | nixos/modules/misc/version.nix | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 5afdcf214f27..8a52df42dd80 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -6,12 +6,35 @@ with lib; options = { + system.stateVersion = mkOption { + type = types.str; + default = config.system.nixosRelease; + description = '' + Every once in a while, a new NixOS release may change + configuration defaults in a way incompatible with stateful + data. For instance, if the default version of PostgreSQL + changes, the new version will probably be unable to read your + existing databases. To prevent such breakage, you can set the + value of this option to the NixOS release with which you want + to be compatible. The effect is that NixOS will option + defaults corresponding to the specified release (such as using + an older version of PostgreSQL). + ''; + }; + system.nixosVersion = mkOption { internal = true; type = types.str; description = "NixOS version."; }; + system.nixosRelease = mkOption { + internal = true; + type = types.str; + default = readFile "${toString pkgs.path}/.version"; + description = "NixOS release."; + }; + system.nixosVersionSuffix = mkOption { internal = true; type = types.str; @@ -41,8 +64,7 @@ with lib; config = { - system.nixosVersion = - mkDefault (readFile "${toString pkgs.path}/.version" + config.system.nixosVersionSuffix); + system.nixosVersion = mkDefault (config.system.nixosRelease + config.system.nixosVersionSuffix); system.nixosVersionSuffix = let suffixFile = "${toString pkgs.path}/.version-suffix"; in |