diff --git a/lib/modules/rclone.nix b/lib/modules/rclone.nix index 2ad84c1..d45e155 100644 --- a/lib/modules/rclone.nix +++ b/lib/modules/rclone.nix @@ -2,6 +2,7 @@ let cfg = config.programs.rclone; targetName = "rclone"; + mkIfNotNull = value: result: lib.mkIf (value != null) result; mkSystemdDependencyOption = { default, global ? false, ... }: lib.mkOption { @@ -40,7 +41,7 @@ let }; mkWebdavProvider = { vendor, vendorName }: ( - mkProvider { + { providerOptions, ... }@args: mkProvider { displayName = vendorName; options = { @@ -73,7 +74,16 @@ let default = null; }; }; - }); + + config = lib.mkMerge [ + { + inherit vendor; + url = providerOptions.url; + } + (mkIfNotNull providerOptions.username { user = providerOptions.username; }) + (mkIfNotNull providerOptions.obscuredPassword { pass = providerOptions.obscuredPassword; }) + ]; + } args); syncProviders = { nextcloud = mkProvider {}; @@ -205,6 +215,9 @@ in { ExecStart = let + configFile = pkgs.writeText + "${serviceName}.conf" + (lib.generators.toINI { } { name = sync.config; }); script = pkgs.writeShellScriptBin serviceName '' ${sync.secretsScript} bash -c echo hello world