diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2017-10-01 17:00:22 +0200 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2017-10-01 17:00:44 +0200 |
| commit | 36ba568fc46df8fe2f142892bb1f9bc678a0ebe4 (patch) | |
| tree | a749b5749edaa80900735ef9b4bcd5b6dc097427 /modules/system | |
| parent | 312bc0ee9a8179d67e03939a325c054bc55806b1 (diff) | |
system-version: add assertioon for stateVersion
Diffstat (limited to 'modules/system')
| -rw-r--r-- | modules/system/version.nix | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/system/version.nix b/modules/system/version.nix index 5a6b247..087e8dd 100644 --- a/modules/system/version.nix +++ b/modules/system/version.nix @@ -1,10 +1,12 @@ -{ config, lib, pkgs, ... }: +{ options, config, lib, pkgs, ... }: with lib; let cfg = config.system; + defaultStateVersion = options.system.stateVersion.default; + gitCommitId = lib.substring 0 7 (commitIdFromGitRepo gitRepo); gitRepo = "${toString pkgs.path}/.git"; releaseFile = "${toString pkgs.path}/.version"; @@ -72,5 +74,7 @@ in system.nixpkgsRevision = mkIf (pathIsDirectory gitRepo) (mkDefault gitCommitId); system.nixpkgsVersionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId)); + assertions = [ { assertion = cfg.stateVersion <= defaultStateVersion; message = "system.stateVersion = ${toString cfg.stateVersion}; is not a valid value"; } ]; + }; } |
