08981e63c6
* //tools/nixery/popcount: replace removed buildGoPackage with buildGoModule. * //users/aspen/system/system/modules: pkgs.nerdfonts has been removed. Instead we have a pkgs.nerd-fonts attribute set that contains all fonts as individual derivations. * //users/tazjin/presentations: The ms package was removed from texlive for some reason in the latest release. Replace it with the packages it bundles (according to CTAN). * //tvix/verify-lang-tests: Test on latest Nix release 2.25.2. * //tvix/*-go: regenerate code from protobufs. Change-Id: I19fcb3a0267f929f6e7388aa69ad99ac53b62236 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12859 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: aspen <root@gws.fyi> Tested-by: BuildkiteCI |
||
---|---|---|
.. | ||
default.nix | ||
popcount.go | ||
README.md |
popcount
This script is used to count the popularity for each package in nixpkgs
, by
determining how many other packages depend on it.
It skips over all packages that fail to build, are not cached or are unfree - but these omissions do not meaningfully affect the statistics.
It currently does not evaluate nested attribute sets (such as
haskellPackages
).
Usage
-
Generate a list of all top-level attributes in
nixpkgs
:nix eval '(with builtins; toJSON (attrNames (import <nixpkgs> {})))' | jq -r | jq > all-top-level.json
-
Run
./popcount > all-runtime-deps.txt
-
Collect and count the results with the following magic incantation:
cat all-runtime-deps.txt \ | sed -r 's|/nix/store/[a-z0-9]+-||g' \ | sort \ | uniq -c \ | sort -n -r \ | awk '{ print "{\"" $2 "\":" $1 "}"}' \ | jq -c -s '. | add | with_entries(select(.value > 1))' \ > your-output-file
In essence, this will trim Nix's store paths and hashes from the output, count the occurrences of each package and return the output as JSON. All packages that have no references other than themselves are removed from the output.