fix(lib): mkValueOrSecretOption allow value to be null

This commit is contained in:
Jaka Hudoklin 2017-11-28 12:45:30 +01:00
parent 8c45a7e1d8
commit c3b31f0161

View file

@ -31,7 +31,7 @@ rec {
(pkgs.runCommand "value-to-b64" {} "echo '${value}' | ${pkgs.coreutils}/bin/base64 -w0 > $out"); (pkgs.runCommand "value-to-b64" {} "echo '${value}' | ${pkgs.coreutils}/bin/base64 -w0 > $out");
mkValueOrSecretOption = {...}@options: mkOption ({ mkValueOrSecretOption = {...}@options: mkOption ({
type = types.either types.str (types.submodule { type = types.nullOr (types.either types.str (types.submodule {
options.secret = mkOption { options.secret = mkOption {
description = "Name of the secret where password is stored"; description = "Name of the secret where password is stored";
type = types.str; type = types.str;
@ -42,7 +42,7 @@ rec {
type = types.str; type = types.str;
default = "password"; default = "password";
}; };
}); }));
apply = value: apply = value:
if isAttrs value if isAttrs value