about summary refs log tree commit diff
path: root/users/edef
diff options
context:
space:
mode:
Diffstat (limited to 'users/edef')
-rw-r--r--users/edef/depot-scan.nix12
-rwxr-xr-xusers/edef/sources.pl11
2 files changed, 23 insertions, 0 deletions
diff --git a/users/edef/depot-scan.nix b/users/edef/depot-scan.nix
new file mode 100644
index 000000000000..faa91855e8f9
--- /dev/null
+++ b/users/edef/depot-scan.nix
@@ -0,0 +1,12 @@
+{ 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
+''
diff --git a/users/edef/sources.pl b/users/edef/sources.pl
new file mode 100755
index 000000000000..39550d83c1a5
--- /dev/null
+++ b/users/edef/sources.pl
@@ -0,0 +1,11 @@
+#! /usr/bin/env -S perl -ln
+use strict;
+
+if (/^evaluating file '(.*)'$/ or
+    /^copied source '(.*)' -> '.*'$/ or
+    /^trace: lorri read: '(.*)'$/) {
+    print $1;
+    next;
+}
+
+print STDERR unless /^instantiated '.*' -> '.*'$/;