* Run the garbage collector on non-NixOS machines via ssh.
svn path=/configurations/trunk/tud/; revision=32357
Eelco Dolstra committed
Feb 17, 2012 at 16:51 UTC
c812e256bef03d48ee2ca7bd253b83114037af3d
1 file changed
+14
-1
lucifer.nix
+14
-1
@@ -76,7 +76,20 @@
76
*/
77
78
services.cron.systemCronJobs =
79
- [ "*/5 * * * * hydra-mirror flock -x /data/releases/.lock -c /home/hydra-mirror/release/mirror/mirror-nixos-isos.sh >> /home/hydra-mirror/nixos-mirror.log 2>&1" ];
79
+ let
80
+ # Run the garbage collector on ‘machine’ to ensure that at least
81
+ # ‘gbFree’ GiB are free.
82
+ gcRemote = { machine, gbFree ? 3, df ? "df" }:
83
+ "15 03 * * * root ssh -x -i /root/.ssh/id_buildfarm ${machine} " +
84
+ ''nix-store --gc --max-freed '$((${toString gbFree} * 1024**3 - 1024 * $(${df} -P -k /nix/store | tail -n 1 | awk "{ print \$4 }")))' > "/var/log/gc-${machine}.log" 2>&1'';
85
+ in
86
+ [ "*/5 * * * * hydra-mirror flock -x /data/releases/.lock -c /home/hydra-mirror/release/mirror/mirror-nixos-isos.sh >> /home/hydra-mirror/nixos-mirror.log 2>&1"
87
+ (gcRemote { machine = "nix@butters"; })
88
+ (gcRemote { machine = "nix@garrison"; })
89
+ (gcRemote { machine = "nix@demon"; })
90
+ (gcRemote { machine = "nix@beastie"; })
91
+ (gcRemote { machine = "nix@tweek"; gbFree = 2; df = "/usr/gnu/bin/df"; })
92
+ ];
93
94
services.cgroups = {
95
enable = true;