tvl-depot/users/edef/depot-scan.nix
edef 48e47d9280 feat(edef/depot-scan): init
A small script that parses `nix-instantiate -vv` output to track the
files read while instantiating a depot build.

Change-Id: I5acf31d55f39c1d1acf9cdead03d33e2c8abab6a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1646
Reviewed-by: edef <edef@edef.eu>
Tested-by: BuildkiteCI
2020-08-05 00:46:00 +00:00

12 lines
322 B
Nix

{ pkgs, ... }:
pkgs.writeShellScriptBin "depot-scan" ''
set -euo pipefail
path=$(git rev-parse --show-prefix)
path="''${path%%/}"
attr="''${path//\//.}"
root="$(git rev-parse --show-toplevel)"
echo "scanning //$path" >&2
nix-instantiate "$root" -A "$attr" -vv 2> >(${pkgs.perl}/bin/perl sources.pl) >&2
''