From 2b6b76570e9e86aadc8a07f857817101612dd7ba Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 9 Dec 2019 19:51:15 +0000 Subject: [PATCH] feat(read-tree): Mark derivations that have children 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. --- read-tree.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/read-tree.nix b/read-tree.nix index ba3fd99f8..fd72c2619 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;