diff --git a/lib/modules/rclone.nix b/lib/modules/rclone.nix index d45e155..0d20ffb 100644 --- a/lib/modules/rclone.nix +++ b/lib/modules/rclone.nix @@ -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);