From 5bde7e23581dbcc588561bb0bf579ec43f6240ba Mon Sep 17 00:00:00 2001 From: Yureka Date: Sat, 20 Jul 2024 15:13:44 +0200 Subject: [PATCH] use dedicated store partition for hydra builds --- services/baremetal-builder/default.nix | 12 ++++++++++++ services/hydra/default.nix | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/services/baremetal-builder/default.nix b/services/baremetal-builder/default.nix index 5ae0820..f3dfa70 100644 --- a/services/baremetal-builder/default.nix +++ b/services/baremetal-builder/default.nix @@ -57,6 +57,11 @@ in fsType = "xfs"; }; + fileSystems."/mnt" = { + device = "/dev/disk/by-label/hydra"; + fsType = "xfs"; + }; + fileSystems."/boot" = { device = "/dev/disk/by-label/BOOT"; fsType = "vfat"; @@ -135,6 +140,13 @@ in MaxStartups = "500:30:1000"; }; + systemd.services.hydra-gc = { + description = "Nix Garbage Collector"; + script = "exec ${config.nix.package.out}/bin/nix-store --gc --store /mnt"; + serviceConfig.Type = "oneshot"; + startAt = "hourly"; + }; + systemd.timers.hydra-gc.timerConfig.Persistent = true; bagel.sysadmin.enable = true; diff --git a/services/hydra/default.nix b/services/hydra/default.nix index dec68b0..7fcfeae 100644 --- a/services/hydra/default.nix +++ b/services/hydra/default.nix @@ -14,7 +14,7 @@ let # XXX: to support Nix's dumb public host key syntax (base64'd), this outputs # a string with shell-style command interpolations: $(...). mkBaremetalBuilder = { parallelBuilds, publicHostKey, host, speedFactor ? 1, user ? "builder", supportedSystems ? [ "i686-linux" "x86_64-linux" ], supportedFeatures ? [ "big-parallel" "kvm" "nixos-test" ] }: - "ssh://${user}@${host} ${lib.concatStringsSep "," supportedSystems} ${config.age.secrets.hydra-ssh-key-priv.path} ${toString parallelBuilds} ${toString speedFactor} ${lib.concatStringsSep "," supportedFeatures} - $(echo -n '${publicHostKey}' | base64 -w0)"; + "ssh://${user}@${host}?remote-store=/mnt ${lib.concatStringsSep "," supportedSystems} ${config.age.secrets.hydra-ssh-key-priv.path} ${toString parallelBuilds} ${toString speedFactor} ${lib.concatStringsSep "," supportedFeatures} - $(echo -n '${publicHostKey}' | base64 -w0)"; # TODO: # - generalize to new architectures