Make provider displayname more accessible
This commit is contained in:
parent
5e7d685d60
commit
52e6775be6
1 changed files with 12 additions and 26 deletions
|
@ -22,26 +22,8 @@ let
|
|||
inherit default;
|
||||
};
|
||||
|
||||
mkProvider =
|
||||
{
|
||||
displayName ? "Custom",
|
||||
secretsScript ? "",
|
||||
environment ? { },
|
||||
config ? { },
|
||||
options ? { }
|
||||
}:
|
||||
{ ... }: {
|
||||
inherit
|
||||
displayName
|
||||
secretsScript
|
||||
environment
|
||||
config
|
||||
options
|
||||
;
|
||||
};
|
||||
|
||||
mkWebdavProvider = { vendor, vendorName }: (
|
||||
{ providerOptions, ... }@args: mkProvider {
|
||||
{ providerOptions, ... }: {
|
||||
displayName = vendorName;
|
||||
|
||||
options = {
|
||||
|
@ -83,12 +65,16 @@ let
|
|||
(mkIfNotNull providerOptions.username { user = providerOptions.username; })
|
||||
(mkIfNotNull providerOptions.obscuredPassword { pass = providerOptions.obscuredPassword; })
|
||||
];
|
||||
} args);
|
||||
});
|
||||
|
||||
syncProviders = {
|
||||
nextcloud = mkProvider {};
|
||||
proton = mkProvider {};
|
||||
manual = mkProvider {};
|
||||
nextcloud = rec {
|
||||
displayName = "Nextcloud";
|
||||
provider = (mkWebdavProvider {
|
||||
vendor = "nextcloud";
|
||||
vendorName = displayName;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
mkSyncType = provider: lib.types.submodule (
|
||||
|
@ -153,9 +139,9 @@ in {
|
|||
};
|
||||
|
||||
configs = (builtins.mapAttrs
|
||||
(name: provider: lib.mkOption {
|
||||
type = lib.types.attrsOf (mkSyncType provider);
|
||||
description = "The ${(provider config).displayName} synchronizations to set up.";
|
||||
(name: providerDefinition: lib.mkOption {
|
||||
type = lib.types.attrsOf (mkSyncType providerDefinition.provider);
|
||||
description = "The ${providerDefinition.displayName} synchronizations to set up.";
|
||||
default = { };
|
||||
})
|
||||
syncProviders);
|
||||
|
|
Loading…
Reference in a new issue