diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2017-12-03 18:22:48 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2017-12-03 18:22:48 +0100 |
| commit | 2c6f80380f897104f4e920265cc6a3040cfab909 (patch) | |
| tree | 0cc0ed444f3ab882361c6fedac2b268d792e3d31 /modules | |
| parent | 7045686b62a96ca381a8fad86714787844575c9f (diff) | |
improve git revision detection
lib.pathIsDirectory doesn't follow symlinks causing the git revision
detection to fail if NIX_PATH points to a symlink.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/system/version.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/system/version.nix b/modules/system/version.nix index 087e8dd..72aeea7 100644 --- a/modules/system/version.nix +++ b/modules/system/version.nix @@ -8,7 +8,7 @@ let defaultStateVersion = options.system.stateVersion.default; gitCommitId = lib.substring 0 7 (commitIdFromGitRepo gitRepo); - gitRepo = "${toString pkgs.path}/.git"; + gitRepo = "${toString pkgs.path}/.git/"; releaseFile = "${toString pkgs.path}/.version"; revisionFile = "${toString pkgs.path}/.git-revision"; suffixFile = "${toString pkgs.path}/.version-suffix"; @@ -71,8 +71,8 @@ in # These defaults are set here rather than up there so that # changing them would not rebuild the manual system.nixpkgsVersion = mkDefault (cfg.nixpkgsRelease + cfg.nixpkgsVersionSuffix); - system.nixpkgsRevision = mkIf (pathIsDirectory gitRepo) (mkDefault gitCommitId); - system.nixpkgsVersionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId)); + system.nixpkgsRevision = mkIf (builtins.pathExists gitRepo) (mkDefault gitCommitId); + system.nixpkgsVersionSuffix = mkIf (builtins.pathExists gitRepo) (mkDefault (".git." + gitCommitId)); assertions = [ { assertion = cfg.stateVersion <= defaultStateVersion; message = "system.stateVersion = ${toString cfg.stateVersion}; is not a valid value"; } ]; |
