diff options
author | Vincent Ambo <tazjin@google.com> | 2019-12-09T19·51+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2019-12-09T19·51+0000 |
commit | 2b6b76570e9e86aadc8a07f857817101612dd7ba (patch) | |
tree | 7aa0b789398d0fc1cdb797521a53cd9c5949394b /read-tree.nix | |
parent | c81be2f836da3047c8c1548bd71ca3f55b7a1762 (diff) |
feat(read-tree): Mark derivations that have children r/118
Adds a `__treeChildren` attribute that is set to `true` on derivations that have children, e.g. for cases where a folder contains a `default.nix` but has subdirectories with additional things in them.
Diffstat (limited to 'read-tree.nix')
-rw-r--r-- | read-tree.nix | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/read-tree.nix b/read-tree.nix index ba3fd99f8134..fd72c2619cfc 100644 --- a/read-tree.nix +++ b/read-tree.nix @@ -1,7 +1,4 @@ # TODO(tazjin): avoid {} by only calling functions *after* checking what they are -# TODO(tazjin): add an attribute to derivations that have children to -# indicate that traversal should continue for ... traversal use-cases -# (such as CI package filtering) args: initPath: @@ -78,7 +75,9 @@ let allContents = f path (attrsToList dir); dirOnlyContents = f path (filter (f: f.value == "directory") (attrsToList dir)); in if dir ? "default.nix" - then import path (argsWithPath args (pathParts path)) // dirOnlyContents + then import path (argsWithPath args (pathParts path)) + // { __treeChildren = true; } # used downstream for traversals + // dirOnlyContents else allContents; readTree = path: importOr path (readDir path) traverse; |