aboutsummaryrefslogtreecommitdiff
path: root/bin/gc
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gc')
-rwxr-xr-xbin/gc27
1 files changed, 24 insertions, 3 deletions
diff --git a/bin/gc b/bin/gc
index b156b08..cd341ea 100755
--- a/bin/gc
+++ b/bin/gc
@@ -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