diff options
author | EuAndreh <eu@euandre.org> | 2024-04-25 15:55:54 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-04-25 15:55:54 -0300 |
commit | 0b720343053dd0f67faa53698ebe748fbeddc6b3 (patch) | |
tree | cd6faedf9acf2c82405483f9f728079a33ea978e /bin/gc | |
parent | etc/sh/rc: export $TD_USE_BUILTIN_HOOKS (diff) | |
download | dotfiles-0b720343053dd0f67faa53698ebe748fbeddc6b3.tar.gz dotfiles-0b720343053dd0f67faa53698ebe748fbeddc6b3.tar.xz |
Revert "Remove Nix/NixOS support from configuration and utilities"
This reverts commit 3b2d27457db9ef8911893fa1b843560f1ccab2eb.
Diffstat (limited to 'bin/gc')
-rwxr-xr-x | bin/gc | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -18,6 +18,7 @@ help() { TYPE what to do GC on (default: all): - guix + - nix - trash - tmpdir - coredump @@ -93,6 +94,25 @@ gc_guix() { fi } +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_trash() { yes | trash-empty } @@ -122,6 +142,7 @@ gc_docker() { TYPES=' guix +nix trash tmpdir docker |