From 0a80f7f43e78ae6806429fda1e494c88ffc6ed02 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 20 Jan 2023 11:26:21 -0500 Subject: script to find live links to large nix closures --- nix-audit-sizes | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 nix-audit-sizes 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 -- cgit v1.2.3