about summary refs log tree commit diff
path: root/nix/readTree
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2020-08-04T08·50+0000
committeredef <edef@edef.eu>2020-08-04T22·55+0000
commit58e3608e258d35e1a8b132cd65a20d2200f01b9f (patch)
tree3f860afbb07a0a4e24f9f43dafd60d8c1573fa88 /nix/readTree
parent1c96e14174dc281fc5aec4f9a771b5d55eb8f150 (diff)
feat(nix/readTree): allow arguments to depend on tree location r/1586
This accepts a function for args, and passes it an attrset containing
the locatedAt parameter.

Change-Id: I3c0f8ca00605e02a787fda88f32b06f5ef9998f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1639
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'nix/readTree')
-rw-r--r--nix/readTree/default.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/nix/readTree/default.nix b/nix/readTree/default.nix
index 4faf20d9e5c0..9793310eeda0 100644
--- a/nix/readTree/default.nix
+++ b/nix/readTree/default.nix
@@ -17,9 +17,9 @@ let
     readDir
     substring;
 
-  argsWithPath = parts: args // {
-    locatedAt = parts;
-  };
+  argsWithPath = parts:
+    let meta.locatedAt = parts;
+    in meta // (if isAttrs args then args else args meta);
 
   readDirVisible = path:
     let