Create rclone syncs during setup

This commit is contained in:
Manuel Thalmann 2024-07-20 13:47:07 +02:00
parent 3135643d3f
commit aa2e535968
3 changed files with 27 additions and 3 deletions

View file

@ -8,6 +8,11 @@
syncType = types.submodule ( syncType = types.submodule (
{ ... }: { { ... }: {
options = { options = {
dirName = mkOption {
type = types.str;
description = "The name of the directory to sync the remote files to.";
};
cacheDuration = mkOption { cacheDuration = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
description = "The amount of time to keep cached files."; description = "The amount of time to keep cached files.";

View file

@ -49,8 +49,13 @@
rclone = { rclone = {
configurations = { configurations = {
nextcloud = {}; nextcloud = {
proton = {}; dirName = "Nextcloud";
};
proton = {
dirName = "Proton";
};
}; };
}; };
}; };

View file

@ -37,7 +37,21 @@ begin
rm ~"$name"/.config/plasma-welcomerc rm ~"$name"/.config/plasma-welcomerc
else else
echo "Please complete the setup of your rclone configurations!" echo "Please complete the setup of your rclone configurations!"
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 rclone config || true
systemctl --user enable "$serviceName" --now || true
end
end end
end end
end end