Create rclone
syncs during setup
This commit is contained in:
parent
3135643d3f
commit
aa2e535968
3 changed files with 27 additions and 3 deletions
|
@ -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.";
|
||||||
|
|
|
@ -49,8 +49,13 @@
|
||||||
|
|
||||||
rclone = {
|
rclone = {
|
||||||
configurations = {
|
configurations = {
|
||||||
nextcloud = {};
|
nextcloud = {
|
||||||
proton = {};
|
dirName = "Nextcloud";
|
||||||
|
};
|
||||||
|
|
||||||
|
proton = {
|
||||||
|
dirName = "Proton";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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!"
|
||||||
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue