diff options
author | EuAndreh <eu@euandre.org> | 2023-02-22 21:23:35 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-02-22 21:23:35 -0300 |
commit | 603f4713c8b639a55ab4cb6e48ea7ec31d6377ec (patch) | |
tree | ccfb8bcd83ca251d82c009b11279b6d17f408c97 | |
parent | bin/menu: Disable clipmenu when copying passwords (diff) | |
download | dotfiles-603f4713c8b639a55ab4cb6e48ea7ec31d6377ec.tar.gz dotfiles-603f4713c8b639a55ab4cb6e48ea7ec31d6377ec.tar.xz |
bin/gc: Do Nix GC too
-rwxr-xr-x | bin/gc | 27 |
1 files changed, 24 insertions, 3 deletions
@@ -79,12 +79,32 @@ disk() { gc_guix() { - pass show velhinho/andreh | head -n1 | sudo -iS guix system delete-generations - pass show velhinho/andreh | head -n1 | sudo -iS guix gc --optimize -d + if [ -e /var/guix/profiles/system ]; then + pass show "$(hostname)"/andreh | head -n1 | + sudo -iS sh -c 'guix system delete-generations && guix gc -d' + fi guix home delete-generations - guix gc --optimize -d + guix gc -d } +gc_nix() { + if [ ! -e /nix/ ]; then + return + fi + + PROFILES=' + /nix/var/nix/profiles/per-user/root/channels + /nix/var/nix/profiles/system + ' + + for p in $PROFILES; do + pass show "$(hostname)"/andreh | head -n1 | + sudo -iS nix-env --delete-generations old -p "$p" + done + nix-env --delete-generations old + nix-store --gc + nix-collect-garbage -d +} gc_nohup() { find ~/ -type f -name 'nohup.out' -exec rm -vf "{}" \; } @@ -123,6 +143,7 @@ gc_vcs() { gc_all() { set -x gc_guix + gc_nix gc_nohup gc_trash gc_tmpdir |