Clean up hm generations in gc script too

This commit is contained in:
David Morgan 2024-01-02 16:14:39 +00:00
parent 4ae562d3a7
commit cf5acce440
Signed by: djm
GPG Key ID: C171251002C200F2
1 changed files with 12 additions and 4 deletions

View File

@ -202,12 +202,20 @@ in
return 2
fi
DOAS=$(command -v doas)
if [ $1 -eq 0 ] ; then
$DOAS nix-collect-garbage -d
if [ $1 -eq 0 ] ; then
GC_ARGS=(-d)
else
$DOAS nix-collect-garbage --delete-older-than ''${1}d
GC_ARGS=(--delete-older-than ''${1}d)
fi
DOAS=$(command -v doas)
# Run as the current user (as well as root) to clean up hm generations
nix-collect-garbage ''${GC_ARGS[@]}
if [ -n $DOAS ] ; then
$DOAS nix-collect-garbage ''${GC_ARGS[@]}
fi
df -h
date
}