about summary refs log tree commit diff
path: root/ops/nixos/whitby
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-02T19·27+0100
committertazjin <mail@tazj.in>2020-07-02T20·54+0000
commit4d9c6dbbe22905a941e5039a6b27f80f6edb7648 (patch)
treef6faa69db4b104a67b079dab9e35a5573d063b1a /ops/nixos/whitby
parent7114e72d8105032b0014b606316df2a619975a33 (diff)
feat(whitby): Run a handful of Buildkite agents r/1171
This is the point of the machine, afterall.

Change-Id: I15c11600c1c18fa8962d57f75f99a72e1553f9c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/853
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: BuildkiteCI
Tested-by: BuildkiteCI
Diffstat (limited to 'ops/nixos/whitby')
-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