about summary refs log tree commit diff
path: root/nix/readTree/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/readTree/default.nix')
-rw-r--r--nix/readTree/default.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/nix/readTree/default.nix b/nix/readTree/default.nix
index 4d5385921e..633915f78b 100644
--- a/nix/readTree/default.nix
+++ b/nix/readTree/default.nix
@@ -4,7 +4,12 @@
 #
 # Provides a function to automatically read a a filesystem structure
 # into a Nix attribute set.
-{ ... }:
+#
+# Optionally accepts an argument `argsFilter` on import, which is a
+# function that receives the current tree location (as a list of
+# strings) and the argument set and can arbitrarily modify it.
+{ argsFilter ? (x: _parts: x)
+, ... }:
 
 let
   inherit (builtins)
@@ -56,7 +61,7 @@ let
         assert assertMsg
           (pathType == "lambda")
           "readTree: trying to import ${toString path}, but it’s a ${pathType}, you need to make it a function like { depot, pkgs, ... }";
-        importedFile (argsWithPath args parts);
+        importedFile (argsFilter (argsWithPath args parts) parts);
     in if (isAttrs imported)
       then imported // (marker parts)
       else imported;