about summary refs log tree commit diff
path: root/users/edef/refscan/testdata/generate.sh
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2023-01-09T20·12+0000
committeredef <edef@edef.eu>2023-01-09T20·15+0000
commit0b3c0725a28786c8d8f2bfc659e8f0a5beedb05a (patch)
tree0d028b57aec6ef25be236992d0d06c9e4305a0c7 /users/edef/refscan/testdata/generate.sh
parent681800b438fa66f897759a197aba82f0122efcc3 (diff)
feat(users/edef/refscan): high-performance Nix reference scanner r/5636
Research-grade code, treat with care.

Change-Id: I99804df93e64101ef24928238ef0a8a02b59c2aa
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7686
Reviewed-by: edef <edef@edef.eu>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/edef/refscan/testdata/generate.sh')
-rwxr-xr-xusers/edef/refscan/testdata/generate.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/users/edef/refscan/testdata/generate.sh b/users/edef/refscan/testdata/generate.sh
new file mode 100755
index 000000000000..02d8c4056789
--- /dev/null
+++ b/users/edef/refscan/testdata/generate.sh
@@ -0,0 +1,6 @@
+#! /usr/bin/env bash
+set -euo pipefail
+
+drv=$(nix-instantiate '<nixpkgs>' -A ghc)
+nix --extra-experimental-features nix-command show-derivation -r "$drv" | jq -r '.[] | .outputs[].path, .inputSrcs[]' | sort -u | cut -d/ -f4 | cut -d- -f1 > maxrefs
+nix-store --dump "$(nix-build "$drv")" > nar