diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix
index 7670687710363..e33ee8c6ba7d0 100644
--- a/nixos/lib/testing.nix
+++ b/nixos/lib/testing.nix
@@ -188,6 +188,7 @@ in rec {
networking.hostName = "client";
nix.readOnlyStore = false;
virtualisation.writableStore = false;
+ system.stateVersion = "19.09"; # TODO: determine automatically
}
];
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index 3ae60cb791601..54009f214ac83 100644
--- a/nixos/modules/misc/version.nix
+++ b/nixos/modules/misc/version.nix
@@ -49,17 +49,20 @@ in
stateVersion = mkOption {
type = types.str;
- default = cfg.release;
+ # Deliberately no default, as automatically upgrading the stateVersion can
+ # lead systems to stop working.
+ example = cfg.release;
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).
+ This option exists to prevent breakage for NixOS modules that depend on
+ state which can't be controlled by them. The value of this option
+ represents the initial NixOS version installed, and should
+ therefore not be ever changed unless you make sure to run all
+ necessary migrations yourself. By fixing this value, NixOS modules can
+ know what version your state is in, such that they can make incompatible
+ changes for new installations, without breaking the module for all
+ existing installations. For example this is used in the postgresql
+ module, where a new module version uses a newer postgresql version which
+ can't read the databases of older versions.
'';
};