From 68ab0a0705ec08eea3259e957fbd4db5107ee6a6 Mon Sep 17 00:00:00 2001 From: edef Date: Wed, 5 Aug 2020 01:52:12 +0000 Subject: chore(edef/users/depot-scan): move to a subdir Change-Id: If202b466aa0874048e89e0dc270ff14883510131 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1652 Reviewed-by: edef Tested-by: BuildkiteCI --- users/edef/depot-scan/wrap.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 users/edef/depot-scan/wrap.nix (limited to 'users/edef/depot-scan/wrap.nix') 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 -- cgit 1.4.1