mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
system-version: add assertioon for stateVersion
This commit is contained in:
parent
312bc0ee9a
commit
36ba568fc4
1 changed files with 5 additions and 1 deletions
|
@ -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"; } ];
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue