about summary refs log tree commit diff
path: root/users/edef/depot-scan/wrap.nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/edef/depot-scan/wrap.nix')
-rw-r--r--users/edef/depot-scan/wrap.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/users/edef/depot-scan/wrap.nix b/users/edef/depot-scan/wrap.nix
new file mode 100644
index 000000000000..dcb557a24b1e
--- /dev/null
+++ b/users/edef/depot-scan/wrap.nix
@@ -0,0 +1,15 @@
+# this wraps import to override readFile and readDir to trace the files it touches
+# technique inspired by lorri
+let
+
+  global = {
+    import = global.scopedImport {};
+    scopedImport = x: builtins.scopedImport (global // x);
+    builtins = builtins // {
+      inherit (global) import scopedImport;
+      readFile = path: builtins.trace "depot-scan '${toString path}'" (builtins.readFile path);
+      readDir  = path: builtins.trace "depot-scan '${toString path}'" (builtins.readDir  path);
+    };
+  };
+
+in global.import