summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-01-17 17:12:35 +0100
committerFlorian Klink <flokli@flokli.de>2020-01-17 23:11:26 +0100
commit63c310c07eb04837130c26bc1149e9a19dd2b559 (patch)
treef3834ed653f97e096c977dbf122a527b4fe47e89
parente1ad9d16857d53aab8762249af7bd566856ed81a (diff)
downloadnixpkgs-63c310c07eb04837130c26bc1149e9a19dd2b559.tar
nixpkgs-63c310c07eb04837130c26bc1149e9a19dd2b559.tar.gz
nixpkgs-63c310c07eb04837130c26bc1149e9a19dd2b559.tar.bz2
nixpkgs-63c310c07eb04837130c26bc1149e9a19dd2b559.tar.lz
nixpkgs-63c310c07eb04837130c26bc1149e9a19dd2b559.tar.xz
nixpkgs-63c310c07eb04837130c26bc1149e9a19dd2b559.tar.zst
nixpkgs-63c310c07eb04837130c26bc1149e9a19dd2b559.zip
nixos/buildkite-agent: change option meta-data into tags attrset
This is called tags in the buildkite 3.
-rw-r--r--nixos/modules/services/continuous-integration/buildkite-agent.nix18
1 files changed, 8 insertions, 10 deletions
diff --git a/nixos/modules/services/continuous-integration/buildkite-agent.nix b/nixos/modules/services/continuous-integration/buildkite-agent.nix
index 00b881ffe3c..3c9c92bf052 100644
--- a/nixos/modules/services/continuous-integration/buildkite-agent.nix
+++ b/nixos/modules/services/continuous-integration/buildkite-agent.nix
@@ -74,13 +74,12 @@ in
         '';
       };
 
-      meta-data = mkOption {
-        type = types.str;
-        default = "";
-        example = "queue=default,docker=true,ruby2=true";
+      tags = mkOption {
+        type = types.attrsOf types.str;
+        default = {};
+        example = { queue = "default"; docker = "true"; ruby2 ="true"; };
         description = ''
-          Meta data for the agent. This is a comma-separated list of
-          <code>key=value</code> pairs.
+          Tags for the agent.
         '';
       };
 
@@ -211,9 +210,7 @@ in
         ##     don't end up in the Nix store.
         preStart = let
           sshDir = "${cfg.dataDir}/.ssh";
-          metaData = if cfg.meta-data == ""
-            then ""
-            else "meta-data=${cfg.meta-data}";
+          tagStr = lib.concatStringsSep "," (lib.mapAttrsToList (name: value: "${name}=${value}") cfg.tags);
         in
           ''
             mkdir -m 0700 -p "${sshDir}"
@@ -223,8 +220,8 @@ in
             cat > "${cfg.dataDir}/buildkite-agent.cfg" <<EOF
             token="$(cat ${toString cfg.tokenPath})"
             name="${cfg.name}"
-            ${metaData}
             shell="${cfg.shell}"
+            tags="${tagStr}"
             build-path="${cfg.dataDir}/builds"
             hooks-path="${cfg.hooksPath}"
             ${cfg.extraConfig}
@@ -258,5 +255,6 @@ in
     (mkRenamedOptionModule [ "services" "buildkite-agent" "openssh" "privateKeyPath" ] [ "services" "buildkite-agent" "privateSshKeyPath" ])
     (mkRemovedOptionModule [ "services" "buildkite-agent" "openssh" "publicKey" ]      "SSH public keys aren't necessary to clone private repos.")
     (mkRemovedOptionModule [ "services" "buildkite-agent" "openssh" "publicKeyPath" ]  "SSH public keys aren't necessary to clone private repos.")
+    (mkRenamedOptionModule [ "services" "buildkite-agent" "meta-data"]                 [ "services" "buildkite-agent" "tags" ])
   ];
 }