about summary refs log tree commit diff
path: root/tools/nixery/popcount/popcount
diff options
context:
space:
mode:
Diffstat (limited to 'tools/nixery/popcount/popcount')
-rwxr-xr-xtools/nixery/popcount/popcount13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/nixery/popcount/popcount b/tools/nixery/popcount/popcount
new file mode 100755
index 000000000000..83baf3045da7
--- /dev/null
+++ b/tools/nixery/popcount/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