Skip to content

Instantly share code, notes, and snippets.

@Sigmanificient
Created June 4, 2024 21:50
Show Gist options
  • Save Sigmanificient/4d238fa6bc37abcd210e48862d14b9de to your computer and use it in GitHub Desktop.
Save Sigmanificient/4d238fa6bc37abcd210e48862d14b9de to your computer and use it in GitHub Desktop.
Get the percentage of pkgs that has been migrated to by-name
export count=$( \
curl -L "https://channels.nixos.org/nixos-unstable/packages.json.br" \
| brotli -d --stdout \
| nix run nixpkgs#jq -- ".packages | length")
find pkgs/by-name -maxdepth 1 -type d \
| xargs -i sh -c "find {} -maxdepth 1 -type d| wc -l" \
| tr '\n' '+' \
| python -c "print(eval(input()[:-1]))" \
| python -c "print(100 * int(input()) / $count, '%')" \
| head -c 7 \
| xargs printf "Percentage migrated: %s%%\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment