Simplify creating login options
This commit is contained in:
parent
8da71a0b9e
commit
b0d76f8f46
1 changed files with 25 additions and 17 deletions
|
@ -8,6 +8,28 @@ let
|
||||||
nextcloudVendor = "nextcloud";
|
nextcloudVendor = "nextcloud";
|
||||||
mkIfNotNull = value: name: lib.mkIf (value != null) { ${name} = value; };
|
mkIfNotNull = value: name: lib.mkIf (value != null) { ${name} = value; };
|
||||||
|
|
||||||
|
mkUsernameOption = { service }: lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
description = "The user name for logging in to ${service}.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkPasswordOption = { service }: lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
description = "The password obscured using the `rclone obscure` command for logging in to ${service}.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkPasswordFileOption = { service }: lib.mkOption {
|
||||||
|
type = lib.types.nullOr (lib.types.either lib.types.path lib.types.str);
|
||||||
|
description = "The path to a file containing the password obscured using the `rclone obscure` command for logging in to ${service}.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkServerUsernameOption = { service }: mkUsernameOption { service = "the ${service} server."; };
|
||||||
|
mkServerPasswordOption = { service }: mkPasswordOption { service = "the ${service} server."; };
|
||||||
|
mkServerPasswordFileOption = { service }: mkPasswordFileOption { service = "the ${service} server."; };
|
||||||
|
|
||||||
mkSystemdDependencyOption =
|
mkSystemdDependencyOption =
|
||||||
{ default, global ? false, ... }: lib.mkOption {
|
{ default, global ? false, ... }: lib.mkOption {
|
||||||
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
|
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
|
||||||
|
@ -106,23 +128,9 @@ let
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
username = lib.mkOption {
|
username = mkServerUsernameOption { service = displayName; };
|
||||||
type = lib.types.nullOr lib.types.str;
|
obscuredPassword = mkServerPasswordOption { service = displayName; };
|
||||||
description = "The user name for logging in to the ${displayName} server.";
|
obscuredPasswordFile = mkServerPasswordFileOption { service = displayName; };
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
obscuredPassword = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
description = "The password obscured using the `rclone obscure` command for logging in to the ${displayName} server.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
obscuredPasswordFile = lib.mkOption {
|
|
||||||
type = lib.types.nullOr (lib.types.either lib.types.path lib.types.str);
|
|
||||||
description = "The path to a file containing the password obscured using the `rclone obscure` command for logging in to the ${displayName} server.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
bearerToken = lib.mkOption {
|
bearerToken = lib.mkOption {
|
||||||
type = lib.types.nullOr lib.types.str;
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
|
Loading…
Reference in a new issue