@cryptotaxi247 / infra / commits / eefbd1a0

macs: allow gcing up to 25% of the store

Try accounting for different disk sizes and throughput.

Martin Weinelt committed Dec 19, 2024 at 02:54 UTC eefbd1a08994b7232caa44399ce40e19a3d216fe
1 file changed +3 -2
macs/nix-darwin.nix
+3 -2
@@ -63,13 +63,14 @@ in
63 automatic = true;
64 user = "root";
65 interval = {
66 + # hourly at the 15th minute
67 Minute = 15;
68 };
69 options =
70 let
70 - gbFree = 100;
71 + freePercentage = 0.25; # 25% free
72 in
72 - "--max-freed $((${toString gbFree} * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))";
73 + "--max-freed $(df -k /nix/store | awk 'NR==2 {printf \"%.0f\n\", $2 * 1024 * ${toString freePercentage}}')";
74 };
75 };
76