about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/services/buildkite/default.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/services/buildkite/default.nix b/modules/services/buildkite/default.nix
index a1bd021..72d5e08 100644
--- a/modules/services/buildkite/default.nix
+++ b/modules/services/buildkite/default.nix
@@ -3,6 +3,17 @@ let
   cfg = config.my.services.buildkite;
   agents = lib.range 1 5;
   secrets = config.age.secrets;
+
+  my-gerrit-hook = name:
+    pkgs.writeShellScript "besadii-whitby" ''
+      exec -a ${name} ${pkgs.tools.gerrit-hook}/bin/gerrit-hook "$@"
+    '';
+
+  buildkiteHooks = pkgs.runCommandNoCC "buildkite-hooks" { } ''
+    mkdir -p $out/bin
+    ln -s ${my-gerrit-hook "post-command"} $out/bin/post-command
+  '';
+
 in {
   options.my.services.buildkite = with lib; {
     enable = mkEnableOption "buildkite agent";
@@ -17,6 +28,7 @@ in {
         inherit name;
         enable = true;
         tokenPath = secrets."buildkite/agent".path;
+        hooks.post-command = "${buildkiteHooks}/bin/post-command";
         runtimePackages = with pkgs; [
           bash
           coreutils