diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2020-01-24 14:58:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-24 14:58:31 +0000 |
commit | 402b97fa1ecae97cbbce7211de3e754b347a4a60 (patch) | |
tree | e35433a8f24aa487ed7498d0dc647caa70de9bef /nixos | |
parent | 2a8ad18258d3cf839e9e1a57994822d9c523a72e (diff) | |
parent | 46773a15b3af302c3fb2a6e31fb589553a903099 (diff) | |
download | nixpkgs-402b97fa1ecae97cbbce7211de3e754b347a4a60.tar nixpkgs-402b97fa1ecae97cbbce7211de3e754b347a4a60.tar.gz nixpkgs-402b97fa1ecae97cbbce7211de3e754b347a4a60.tar.bz2 nixpkgs-402b97fa1ecae97cbbce7211de3e754b347a4a60.tar.lz nixpkgs-402b97fa1ecae97cbbce7211de3e754b347a4a60.tar.xz nixpkgs-402b97fa1ecae97cbbce7211de3e754b347a4a60.tar.zst nixpkgs-402b97fa1ecae97cbbce7211de3e754b347a4a60.zip |
Merge pull request #78058 from mayflower/nixos/version-gitdir-symlink
nixos/version: fix case where .git is a symlink
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/misc/version.nix | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index ddbd3963cc5..8a85035ceb7 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -6,6 +6,7 @@ let cfg = config.system.nixos; gitRepo = "${toString pkgs.path}/.git"; + gitRepoValid = lib.pathIsGitRepo gitRepo; gitCommitId = lib.substring 0 7 (commitIdFromGitRepo gitRepo); in @@ -91,8 +92,8 @@ in # These defaults are set here rather than up there so that # changing them would not rebuild the manual version = mkDefault (cfg.release + cfg.versionSuffix); - revision = mkIf (pathExists gitRepo) (mkDefault gitCommitId); - versionSuffix = mkIf (pathExists gitRepo) (mkDefault (".git." + gitCommitId)); + revision = mkIf gitRepoValid (mkDefault gitCommitId); + versionSuffix = mkIf gitRepoValid (mkDefault (".git." + gitCommitId)); }; # Generate /etc/os-release. See |