aboutsummaryrefslogtreecommitdiff
path: root/scripts/gc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gc.sh')
-rwxr-xr-xscripts/gc.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/gc.sh b/scripts/gc.sh
index 9ca5af3..3450be4 100755
--- a/scripts/gc.sh
+++ b/scripts/gc.sh
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
-## Cleaning up the NixOS store
+disk_space() {
+ ,u | awk '{print $5" "$6}'
+}
+
+before=$(disk_space)
+yellow "Cleaning up the NixOS store"
profiles=(per-user/root/channels per-user/andreh/profile per-user/andreh/channels system)
@@ -14,14 +19,14 @@ nix-store --gc
nix-collect-garbage -d
-## Cleanup up the Trash and /tmp folders
+yellow "Cleaning up up the Trash and /tmp folders"
rm -rf ~/.local/share/Trash/files/*
# https://askubuntu.com/a/609396
sudo find /tmp -type f -atime +10 -delete
-## Erasing docker images
+yellow "Erasing docker images"
echo y | docker system prune -a
docker rmi $(docker images -a -q)
@@ -31,3 +36,10 @@ docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
echo y | docker volume prune
+
+after=$(disk_space)
+
+green "Done."
+green "Disk space before and after:"
+blue " before: ${before}"
+blue " after: ${after}"