#!/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