From c9214c394b248e1f26e45dbe1be2bd82363af3a6 Mon Sep 17 00:00:00 2001 From: elseym Date: Fri, 10 Jan 2020 21:24:31 +0100 Subject: 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 --- lib/trivial.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/trivial.nix') 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; -- cgit v1.2.3