From b781eb7e086f595752b91a1cbbfca8f31c394a9b Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 15 May 2024 11:48:22 +0200 Subject: [PATCH] Store the provider options flat --- lib/modules/rclone.nix | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/modules/rclone.nix b/lib/modules/rclone.nix index 955effb..30fa9f9 100644 --- a/lib/modules/rclone.nix +++ b/lib/modules/rclone.nix @@ -17,26 +17,23 @@ let mkProvider = { - secretLoader ? ({ ... }: ""), - envLoader ? ({ ... }: { }), - configLoader ? ({ ... }: { }), - options ? {}, - ... - }: { + secretsScript ? "", + environment ? { }, + config ? { }, + options ? { }, + defaultOptions ? { } + }: + { ... }: { inherit - secretLoader - envLoader - configLoader + secretsScript + environment + config options ; }; syncProviders = { - nextcloud = mkProvider { - options = lib.types.submodule ( - (mkOwncloudOptions { })); - }; - + nextcloud = mkProvider {}; proton = mkProvider {}; manual = mkProvider {}; }; @@ -88,11 +85,16 @@ let }; }; - config = { - environment = syncProviders.${config.type}.envLoader config; - secretsScript = syncProviders.${config.type}.secretLoader config; - config = syncProviders.${config.type}.configLoader config; - }; + config = + let + syncProvider = syncProviders.${config.type} config; + in { + inherit (syncProvider) + environment + secretsScript + config + ; + }; }); in { options = {