From ccb1b8e538e4f2d77f75367f68f42348792b7c2a Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 14 Jan 2020 20:43:47 +0000 Subject: [PATCH] fix(lib/k8s): fix mkSecretOption --- lib/k8s.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/k8s.nix b/lib/k8s.nix index 8eafa94..475ead2 100644 --- a/lib/k8s.nix +++ b/lib/k8s.nix @@ -3,25 +3,27 @@ with lib; rec { - mkSecretOption = {description ? "", default ? null}: mkOption { + mkSecretOption = {description ? "", default ? {}}: mkOption ({ inherit description; type = types.nullOr (types.submodule { options = { name = mkOption { description = "Name of the secret where secret is stored"; type = types.str; + default = default.name or null; }; key = mkOption { description = "Name of the key where secret is stored"; type = types.str; + default = default.key or null; }; }; - - config = mkDefault (if default == null then {} else default); }); - default = default; - }; + default = {}; + } // (optionalAttrs (default == null) { + default = null; + })); secretToEnv = value: { valueFrom.secretKeyRef = {