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;
|
inherit default;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkProvider =
|
|
||||||
{
|
|
||||||
displayName ? "Custom",
|
|
||||||
secretsScript ? "",
|
|
||||||
environment ? { },
|
|
||||||
config ? { },
|
|
||||||
options ? { }
|
|
||||||
}:
|
|
||||||
{ ... }: {
|
|
||||||
inherit
|
|
||||||
displayName
|
|
||||||
secretsScript
|
|
||||||
environment
|
|
||||||
config
|
|
||||||
options
|
|
||||||
;
|
|
||||||
};
|
|
||||||
|
|
||||||
mkWebdavProvider = { vendor, vendorName }: (
|
mkWebdavProvider = { vendor, vendorName }: (
|
||||||
{ providerOptions, ... }@args: mkProvider {
|
{ providerOptions, ... }: {
|
||||||
displayName = vendorName;
|
displayName = vendorName;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -83,12 +65,16 @@ let
|
||||||
(mkIfNotNull providerOptions.username { user = providerOptions.username; })
|
(mkIfNotNull providerOptions.username { user = providerOptions.username; })
|
||||||
(mkIfNotNull providerOptions.obscuredPassword { pass = providerOptions.obscuredPassword; })
|
(mkIfNotNull providerOptions.obscuredPassword { pass = providerOptions.obscuredPassword; })
|
||||||
];
|
];
|
||||||
} args);
|
});
|
||||||
|
|
||||||
syncProviders = {
|
syncProviders = {
|
||||||
nextcloud = mkProvider {};
|
nextcloud = rec {
|
||||||
proton = mkProvider {};
|
displayName = "Nextcloud";
|
||||||
manual = mkProvider {};
|
provider = (mkWebdavProvider {
|
||||||
|
vendor = "nextcloud";
|
||||||
|
vendorName = displayName;
|
||||||
|
});
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSyncType = provider: lib.types.submodule (
|
mkSyncType = provider: lib.types.submodule (
|
||||||
|
@ -153,9 +139,9 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
configs = (builtins.mapAttrs
|
configs = (builtins.mapAttrs
|
||||||
(name: provider: lib.mkOption {
|
(name: providerDefinition: lib.mkOption {
|
||||||
type = lib.types.attrsOf (mkSyncType provider);
|
type = lib.types.attrsOf (mkSyncType providerDefinition.provider);
|
||||||
description = "The ${(provider config).displayName} synchronizations to set up.";
|
description = "The ${providerDefinition.displayName} synchronizations to set up.";
|
||||||
default = { };
|
default = { };
|
||||||
})
|
})
|
||||||
syncProviders);
|
syncProviders);
|
||||||
|
|
Loading…
Reference in a new issue