about summary refs log tree commit diff
path: root/users/edef/depot-scan/wrap.nix
blob: 77362b3f61f9efa53c5bd20ac1f5c564c28c69e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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