Created
April 30, 2024 06:18
-
-
Save Sigmanificient/be93f7cbcec1affbdc1bdd2a930ac0b4 to your computer and use it in GitHub Desktop.
Get the amount of nix lines within the top 10 nixpkgs' nix files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -name "*.nix" \ | |
| xargs -i sh -c " \ | |
cat {} \ | |
| wc -l \ | |
| xargs printf '%06d'; printf '\t%s\n' {}" \ | |
| sort \ | |
| tail -n 10 \ | |
| tr '\t' ' ' \ | |
| cut -d ' ' -f 1 \ | |
| paste -s -d+ - \ | |
| nix run nixpkgs#bc \ | |
| xargs -i python -c \ | |
"$(nix run nixpkgs#tokei \ | |
| grep Total \ | |
| grep -v "(Total)" \ | |
| cut -d ' ' -f 23 \ | |
| python -c \ | |
"print(f'print(f\'{{100 * ({{}} / {input()}):,.2f}}%\')')")" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment