diff --git a/lib/modules/users.nix b/lib/modules/users.nix index 5a8db371..d9f56fc2 100644 --- a/lib/modules/users.nix +++ b/lib/modules/users.nix @@ -8,6 +8,11 @@ syncType = types.submodule ( { ... }: { options = { + dirName = mkOption { + type = types.str; + description = "The name of the directory to sync the remote files to."; + }; + cacheDuration = mkOption { type = types.nullOr types.str; description = "The amount of time to keep cached files."; diff --git a/profiles/Generic/config.nix b/profiles/Generic/config.nix index b9431462..a53beb00 100644 --- a/profiles/Generic/config.nix +++ b/profiles/Generic/config.nix @@ -49,8 +49,13 @@ rclone = { configurations = { - nextcloud = {}; - proton = {}; + nextcloud = { + dirName = "Nextcloud"; + }; + + proton = { + dirName = "Proton"; + }; }; }; }; diff --git a/scripts/Common/Software/rclone/main.fish b/scripts/Common/Software/rclone/main.fish index 9ffb7ef6..384d3308 100644 --- a/scripts/Common/Software/rclone/main.fish +++ b/scripts/Common/Software/rclone/main.fish @@ -37,7 +37,21 @@ begin rm ~"$name"/.config/plasma-welcomerc else echo "Please complete the setup of your rclone configurations!" - rclone config || true + + for config in (echo "$configs" | jq '.[]' --raw-output0 | string split0) + set -l configKey "$key.$config" + set -l duration "$configKey.cacheDuration" + + set -l serviceName "rclone@$config:$(getConfig "$configKey.dirName")" + + if isSet "$duration" + set serviceName "$serviceName:$(getConfig "$duration")" + end + + echo "Please create a remote called `$config`." + rclone config || true + systemctl --user enable "$serviceName" --now || true + end end end end