1
0
Fork 0
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:
Daiderd Jordan 2017-10-01 17:00:22 +02:00
parent 312bc0ee9a
commit 36ba568fc4
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -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"; } ];
};
}