590ce994bb
This script generates an entry in a text file for each time a derivation is referred to by another in nixpkgs. For initial testing, this output can be turned into group-layers compatible JSON with this *trivial* invocation: cat output | awk '{ print "{\"" $2 "\":" $1 "}"}' | jq -s '. | add | with_entries(.key |= sub("/nix/store/[a-z0-9]+-";""))' > test-data.json
13 lines
356 B
Bash
Executable file
13 lines
356 B
Bash
Executable file
#!/bin/bash
|
|
set -ueo pipefail
|
|
|
|
function graphsFor() {
|
|
local pkg="${1}"
|
|
local graphs=$(nix-build --timeout 2 --argstr target "${pkg}" popcount.nix || echo -n 'empty.json')
|
|
cat $graphs | jq -r -cM '.[] | .references[]'
|
|
}
|
|
|
|
for pkg in $(cat all-top-level.json | jq -r '.[]'); do
|
|
graphsFor "${pkg}" 2>/dev/null
|
|
echo "Printed refs for ${pkg}" >&2
|
|
done
|