diff options
author | David Morgan <djm_uk@protonmail.com> | 2024-01-02 16:14:39 +0000 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2024-01-02 16:14:39 +0000 |
commit | cf5acce440a87b18b7e77fcf6f85a743dd339a28 (patch) | |
tree | 0191d3b2ff70cba587fe9ec06cd53e89cdc13b18 /nix-conf/home/includes/zsh.nix | |
parent | 4ae562d3a739a13f9c39191042232b2602efd67b (diff) | |
download | dotfiles-cf5acce440a87b18b7e77fcf6f85a743dd339a28.tar.gz |
Clean up hm generations in gc script too
Diffstat (limited to 'nix-conf/home/includes/zsh.nix')
-rw-r--r-- | nix-conf/home/includes/zsh.nix | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix index 9f3c170..26c88b5 100644 --- a/nix-conf/home/includes/zsh.nix +++ b/nix-conf/home/includes/zsh.nix @@ -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 } |