diff options
author | Florian Klink <flokli@flokli.de> | 2020-01-20 10:28:47 +0100 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2020-01-20 11:10:56 +0100 |
commit | 4b73d3c4441601c8e42063031c6bb0eaa0fec67e (patch) | |
tree | c0741656762701433ab508931efe66eae4125995 /nixos | |
parent | a208e6eb994b997542528371ffa483c7deda98fe (diff) | |
download | nixpkgs-4b73d3c4441601c8e42063031c6bb0eaa0fec67e.tar nixpkgs-4b73d3c4441601c8e42063031c6bb0eaa0fec67e.tar.gz nixpkgs-4b73d3c4441601c8e42063031c6bb0eaa0fec67e.tar.bz2 nixpkgs-4b73d3c4441601c8e42063031c6bb0eaa0fec67e.tar.lz nixpkgs-4b73d3c4441601c8e42063031c6bb0eaa0fec67e.tar.xz nixpkgs-4b73d3c4441601c8e42063031c6bb0eaa0fec67e.tar.zst nixpkgs-4b73d3c4441601c8e42063031c6bb0eaa0fec67e.zip |
nixos/buildkite: make privateSshKeyPath optional
When only cloning public repos, or when the ssh key is provided by different means, we don't need to manage it here.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/continuous-integration/buildkite-agent.nix | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nixos/modules/services/continuous-integration/buildkite-agent.nix b/nixos/modules/services/continuous-integration/buildkite-agent.nix index 66f04b0a424..418a7bc1a46 100644 --- a/nixos/modules/services/continuous-integration/buildkite-agent.nix +++ b/nixos/modules/services/continuous-integration/buildkite-agent.nix @@ -104,7 +104,8 @@ in }; privateSshKeyPath = mkOption { - type = types.path; + type = types.nullOr types.path; + default = null; ## maximum care is taken so that secrets (ssh keys and the CI token) ## don't end up in the Nix store. apply = final: if final == null then null else toString final; @@ -223,11 +224,11 @@ in sshDir = "${cfg.dataDir}/.ssh"; tagStr = lib.concatStringsSep "," (lib.mapAttrsToList (name: value: "${name}=${value}") cfg.tags); in - '' + optionalString (cfg.privateSshKeyPath != null) '' mkdir -m 0700 -p "${sshDir}" cp -f "${toString cfg.privateSshKeyPath}" "${sshDir}/id_rsa" chmod 600 "${sshDir}"/id_rsa - + '' + '' cat > "${cfg.dataDir}/buildkite-agent.cfg" <<EOF token="$(cat ${toString cfg.tokenPath})" name="${cfg.name}" |