git.iko.soy/typeable/nixpkgs
on master help sign in
buildkite: allow configuration and actual use of agent-specific hooks
bbb6072Kosyrev Serge
nixos/modules/services/continuous-integration/buildkite-agent.nix+11−1
@@ -48,6 +48,14 @@ in
48 '';
48 '';
49 };
49 };
50
50
51+ hooks-path = mkOption {
52+ type = types.str;
53+ default = "${pkgs.buildkite-agent}/share/hooks";
54+ description = ''
55+ Path to the directory storing the hooks.
56+ '';
57+ };
58+
51 meta-data = mkOption {
59 meta-data = mkOption {
52 type = types.str;
60 type = types.str;
53 default = "";
61 default = "";
@@ -114,10 +122,12 @@ in
114 token="$(cat ${toString cfg.tokenPath})"
122 token="$(cat ${toString cfg.tokenPath})"
115 name="${cfg.name}"
123 name="${cfg.name}"
116 meta-data="${cfg.meta-data}"
124 meta-data="${cfg.meta-data}"
117− hooks-path="${pkgs.buildkite-agent}/share/hooks"
118 build-path="${cfg.dataDir}/builds"
125 build-path="${cfg.dataDir}/builds"
126+ hooks-path="${cfg.hooks-path}"
119 bootstrap-script="${pkgs.buildkite-agent}/share/bootstrap.sh"
127 bootstrap-script="${pkgs.buildkite-agent}/share/bootstrap.sh"
120 EOF
128 EOF
129+
130+ chmod +x ${cfg.hooks-path}/* 2>/dev/null || true # Guard against read-only paths.
121 '';
131 '';
122
132
123 serviceConfig =
133 serviceConfig =