about summary refs log tree commit diff
path: root/ops
diff options
context:
space:
mode:
Diffstat (limited to 'ops')
-rw-r--r--ops/nixos/whitby/default.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/ops/nixos/whitby/default.nix b/ops/nixos/whitby/default.nix
index d7f60a4d1068..9b663fc8ef09 100644
--- a/ops/nixos/whitby/default.nix
+++ b/ops/nixos/whitby/default.nix
@@ -1,8 +1,18 @@
 { depot, lib, ... }:
 
 let
+  inherit (builtins) listToAttrs;
+  inherit (lib) range;
+
   nixpkgs = import depot.third_party.nixpkgsSrc {};
 
+  # All Buildkite hooks are actually besadii, but it's being invoked
+  # with different names.
+  buildkiteHooks = depot.third_party.runCommandNoCC "buildkite-hooks" {} ''
+    mkdir -p $out/bin
+    ln -s ${depot.ops.besadii}/bin/besadii $out/bin/post-command
+  '';
+
   systemForConfig = configuration: (depot.third_party.nixos {
     inherit configuration;
   }).system;
@@ -119,6 +129,17 @@ in systemForConfig {
   programs.mtr.enable = true;
   services.openssh.enable = true;
 
+  # Run a handful of Buildkite agents to support parallel builds.
+  services.buildkite-agents = listToAttrs (map (n: rec {
+    name = "whitby-${toString n}";
+    value = {
+      inherit name;
+      enable = true;
+      tokenPath = "/etc/secrets/buildkite-agent-token";
+      hooks.post-command = "${buildkiteHooks}/bin/post-command";
+    };
+  }) (range 1 8));
+
   environment.systemPackages = with nixpkgs; [
     bb
     curl