lib.fileset.gitTracked/gitTrackedWith: init

A configuration parameter for gitTrackedWith will be introduced in the
next commit
This commit is contained in:
Silvan Mosberger 2023-11-03 01:24:55 +01:00
parent 91c993afb9
commit 2dfb1d36cf
4 changed files with 255 additions and 1 deletions

View file

@ -825,4 +825,23 @@ rec {
${baseNameOf root} =
fromFile (baseNameOf root) rootType;
};
# Mirrors the contents of a Nix store path relative to a local path as a file set.
# Some notes:
# - The store path is read at evaluation time.
# - The store path must not include files that don't exist in the respective local path.
#
# Type: Path -> String -> FileSet
_mirrorStorePath = localPath: storePath:
let
recurse = focusedStorePath:
mapAttrs (name: type:
if type == "directory" then
recurse (focusedStorePath + "/${name}")
else
type
) (builtins.readDir focusedStorePath);
in
_create localPath
(recurse storePath);
}