about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/readTree/default.nix17
1 files changed, 14 insertions, 3 deletions
diff --git a/nix/readTree/default.nix b/nix/readTree/default.nix
index c48928ee19e4..4faf20d9e5c0 100644
--- a/nix/readTree/default.nix
+++ b/nix/readTree/default.nix
@@ -9,17 +9,28 @@ let
     filter
     hasAttr
     head
+    isAttrs
     length
     listToAttrs
     map
     match
-    isAttrs
-    readDir;
+    readDir
+    substring;
 
   argsWithPath = parts: args // {
     locatedAt = parts;
   };
 
+  readDirVisible = path:
+    let
+      children = readDir path;
+      isVisible = f: f == ".skip-subtree" || (substring 0 1 f) != ".";
+      names = filter isVisible (attrNames children);
+    in listToAttrs (map (name: {
+      inherit name;
+      value = children.${name};
+    }) names);
+
   # The marker is added to every set that was imported directly by
   # readTree.
   importWithMark = path: parts:
@@ -34,7 +45,7 @@ let
 
   readTree = path: parts:
     let
-      dir = readDir path;
+      dir = readDirVisible path;
       self = importWithMark path parts;
       joinChild = c: path + ("/" + c);