diff options
author | edef <edef@edef.eu> | 2020-08-05T01·52+0000 |
---|---|---|
committer | edef <edef@edef.eu> | 2020-08-05T02·05+0000 |
commit | 68ab0a0705ec08eea3259e957fbd4db5107ee6a6 (patch) | |
tree | efe34b7632b2dc0223b0da892961b505c9bbcc5b /users/edef/depot-scan/wrap.nix | |
parent | fcffacf8c9246c7b83d90164bedb50f488ca5baa (diff) |
chore(edef/users/depot-scan): move to a subdir r/1591
Change-Id: If202b466aa0874048e89e0dc270ff14883510131 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1652 Reviewed-by: edef <edef@edef.eu> Tested-by: BuildkiteCI
Diffstat (limited to 'users/edef/depot-scan/wrap.nix')
-rw-r--r-- | users/edef/depot-scan/wrap.nix | 15 |
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 |