git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #120209 from considerate/considerate/multiple-tags-buildkite-agents
152fa54Luke Granger-Brown
nixos/modules/services/continuous-integration/buildkite-agents.nix+7−3
@@ -76,7 +76,7 @@ let
76 };
76 };
77
77
78 tags = mkOption {
78 tags = mkOption {
79− type = types.attrsOf types.str;
79+ type = types.attrsOf (types.either types.str (types.listOf types.str));
80 default = {};
80 default = {};
81 example = { queue = "default"; docker = "true"; ruby2 ="true"; };
81 example = { queue = "default"; docker = "true"; ruby2 ="true"; };
82 description = ''
82 description = ''
@@ -230,7 +230,11 @@ in
230 ## don't end up in the Nix store.
230 ## don't end up in the Nix store.
231 preStart = let
231 preStart = let
232 sshDir = "${cfg.dataDir}/.ssh";
232 sshDir = "${cfg.dataDir}/.ssh";
233+ tagStr = name: value:
234+ if lib.isList value
235+ then lib.concatStringsSep "," (builtins.map (v: "${name}=${v}") value)
236+ else "${name}=${value}";
233− tagStr = lib.concatStringsSep "," (lib.mapAttrsToList (name: value: "${name}=${value}") cfg.tags);
237+ tagsStr = lib.concatStringsSep "," (lib.mapAttrsToList tagStr cfg.tags);
234 in
238 in
235 optionalString (cfg.privateSshKeyPath != null) ''
239 optionalString (cfg.privateSshKeyPath != null) ''
236 mkdir -m 0700 -p "${sshDir}"
240 mkdir -m 0700 -p "${sshDir}"
@@ -241,7 +245,7 @@ in
241 token="$(cat ${toString cfg.tokenPath})"
245 token="$(cat ${toString cfg.tokenPath})"
242 name="${cfg.name}"
246 name="${cfg.name}"
243 shell="${cfg.shell}"
247 shell="${cfg.shell}"
244− tags="${tagStr}"
248+ tags="${tagsStr}"
245 build-path="${cfg.dataDir}/builds"
249 build-path="${cfg.dataDir}/builds"
246 hooks-path="${cfg.hooksPath}"
250 hooks-path="${cfg.hooksPath}"
247 ${cfg.extraConfig}
251 ${cfg.extraConfig}