Skip to content

Commit a0949da

Browse files
antifuchsMic92
authored andcommitted
Replicate the optional secrets logic for env
Using the %(secret:) interpolation fails if the secret isn't set, so we have to guard against looking up secrets that won't be there.
1 parent 06e6fb8 commit a0949da

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

nix/cachix.nix

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,14 @@ in
115115
services.buildbot-nix.master.postBuildSteps = [
116116
{
117117
name = "Upload cachix";
118-
environment = {
119-
CACHIX_SIGNING_KEY = bb-lib.interpolate "%(secret:cachix-signing-key)s";
120-
CACHIX_AUTH_TOKEN = bb-lib.interpolate "%(secret:cachix-auth-token)s";
121-
};
118+
environment = lib.mkMerge [
119+
(lib.optionalAttrs (cfg.cachix.auth ? "signingKey") {
120+
CACHIX_SIGNING_KEY = bb-lib.interpolate "%(secret:cachix-signing-key)s";
121+
})
122+
(lib.optionalAttrs (cfg.cachix.auth ? "authToken") {
123+
CACHIX_AUTH_TOKEN = bb-lib.interpolate "%(secret:cachix-auth-token)s";
124+
})
125+
];
122126
command = [
123127
"cachix" # note that this is the cachix from the worker's $PATH
124128
"push"

0 commit comments

Comments
 (0)