diff options
Diffstat (limited to 'users/edef/depot-scan-wrap.nix')
-rw-r--r-- | users/edef/depot-scan-wrap.nix | 17 |
1 files changed, 17 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..52ea5cc8527b --- /dev/null +++ b/users/edef/depot-scan-wrap.nix @@ -0,0 +1,17 @@ +# 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 |