From 5b9d42cdc0008946531270d355a8b59163ee024c Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 14 May 2024 14:23:30 +0200 Subject: [PATCH] Refactor sync type implementation --- lib/modules/rclone.nix | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/modules/rclone.nix b/lib/modules/rclone.nix index 132ed93..8405326 100644 --- a/lib/modules/rclone.nix +++ b/lib/modules/rclone.nix @@ -1,15 +1,16 @@ { config, lib, pkgs, ... }: let - nextcloud = "nextcloud"; - proton = "proton"; + syncProviders = { + nextcloud = {}; + proton = {}; + }; + syncType = lib.types.submodule ( - { name, ... }: { + { config, name, ... }: { options = { type = lib.mkOption { - type = lib.types.enum [ - nextcloud - proton - ]; + description = "The type of the sync"; + type = lib.types.enum (builtins.attrNames syncProviders); }; autoStart = lib.mkOption { @@ -32,9 +33,9 @@ let default = {}; }; - preLaunch = lib.mkOption { + secretsScript = lib.mkOption { type = lib.types.lines; - description = "A set of statements to run before launching the sync."; + description = "A script for loading secrets before launching the sync."; default = []; }; };