aboutsummaryrefslogtreecommitdiff
path: root/lib/trivial.nix
diff options
context:
space:
mode:
authorelseym <elseym@me.com>2020-01-10 21:24:31 +0100
committerelseym <elseym@me.com>2020-01-10 22:29:48 +0100
commitc9214c394b248e1f26e45dbe1be2bd82363af3a6 (patch)
treef28e88086f844a4d781fc9eb23bf7c078814b963 /lib/trivial.nix
parentb74c26a17f1856735577c29d92939721d542f0f5 (diff)
lib.commitIdFromGitRepo: support git-worktree
lib.commitIdFromGitRepo now resolves the refs from the parent repository in case the supplied path is a file containing the path to said repository. this adds support for git-worktree and things alike. see gitrepository-layout(5). this also: - adds a new boolean function lib.pathIsRegularFile to check whether a path is a regular file - patches lib.revisionWithDefault and the revision and versionSuffix attributes in config.system.nixos in order to support git-worktrees
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r--lib/trivial.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 3a25e31fb052..940ec1a3d59e 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -191,7 +191,7 @@ rec {
let
revisionFile = "${toString ./..}/.git-revision";
gitRepo = "${toString ./..}/.git";
- in if lib.pathIsDirectory gitRepo
+ in if builtins.pathExists gitRepo
then lib.commitIdFromGitRepo gitRepo
else if lib.pathExists revisionFile then lib.fileContents revisionFile
else default;