diff options
author | Ben Sima <ben@bsima.me> | 2023-01-20 11:26:21 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-01-20 11:26:21 -0500 |
commit | 0a80f7f43e78ae6806429fda1e494c88ffc6ed02 (patch) | |
tree | 4df338d65b1fdb8fdd52c60a06de3e788e47a941 /nix-audit-sizes | |
parent | 61daa32d4dd1ff73e44d21c5adceb3e495587286 (diff) |
script to find live links to large nix closures
Diffstat (limited to 'nix-audit-sizes')
-rwxr-xr-x | nix-audit-sizes | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/nix-audit-sizes b/nix-audit-sizes new file mode 100755 index 0000000..b36278c --- /dev/null +++ b/nix-audit-sizes @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# +echo "# this takes a while, be patient..." +roots=$(find -H /nix/var/nix/gcroots/auto -type l) +for root in $roots +do + link=$(readlink $root) + storepath=$(realpath $link) + size=$(nix-store -q --requisites $storepath | sort -uf | xargs du -ch | tail -1 | sed 's/[ ]*total//g') + printf "%s\n\t%s\n\t%s\n\n" $size $link $storepath +done |