diff options
author | Vincent Ambo <tazjin@google.com> | 2019-08-11T19·10+0100 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2019-08-13T23·02+0100 |
commit | 590ce994bb18b15c9b654c2aa426866750c3c494 (patch) | |
tree | b72c1cb3cfc406051be951197a5194f3673b4fa1 /tools/nixery/group-layers/popcount | |
parent | 92078527dbe8f853d984a4038e718c662c016741 (diff) |
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
Diffstat (limited to 'tools/nixery/group-layers/popcount')
-rwxr-xr-x | tools/nixery/group-layers/popcount | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/nixery/group-layers/popcount b/tools/nixery/group-layers/popcount new file mode 100755 index 000000000000..83baf3045da7 --- /dev/null +++ b/tools/nixery/group-layers/popcount @@ -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 |