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
This commit is contained in:
elseym 2020-01-10 21:24:31 +01:00
parent b74c26a17f
commit c9214c394b
No known key found for this signature in database
GPG key ID: 8696D1F9E5C020D2
4 changed files with 32 additions and 10 deletions

View file

@ -100,7 +100,7 @@ let
inherit (sources) pathType pathIsDirectory cleanSourceFilter
cleanSource sourceByRegex sourceFilesBySuffices
commitIdFromGitRepo cleanSourceWith pathHasContext
canCleanSource;
canCleanSource pathIsRegularFile;
inherit (modules) evalModules unifyModuleSyntax
applyIfFunction mergeModules
mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions