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.nix16
1 files changed, 16 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..77362b3f61f9
--- /dev/null
+++ b/users/edef/depot-scan/wrap.nix
@@ -0,0 +1,16 @@
+# 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