feat(group-layers): Add initial popcount scripts
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
This commit is contained in:
parent
92078527db
commit
590ce994bb
2 changed files with 64 additions and 0 deletions
13
tools/nixery/group-layers/popcount
Executable file
13
tools/nixery/group-layers/popcount
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue