nextcloud-sync: Support for ignoring folder

This commit is contained in:
Geoffrey Frogeye 2025-11-14 10:18:33 +01:00
parent b0e67e1c30
commit 08100d41e6

View file

@ -26,6 +26,7 @@ in
url="$1" url="$1"
remote="$2" remote="$2"
local="$3" local="$3"
unsyncedfolders="$4"
echo "Syncing $url $remote to $local" echo "Syncing $url $remote to $local"
# Adding to Syncthing ignores (so it's not double-synced) # Adding to Syncthing ignores (so it's not double-synced)
@ -49,7 +50,7 @@ in
# Actual syncing # Actual syncing
mkdir -p "$local" mkdir -p "$local"
nextcloudcmd -n -h --path "$remote" "$local" "$url" nextcloudcmd --non-interactive -n -h --path "$remote" --unsyncedfolders "$unsyncedfolders" "$local" "$url"
} }
'' ''
@ -60,6 +61,7 @@ in
n.url n.url
n.remote n.remote
"${config.home.homeDirectory}/${n.local}" "${config.home.homeDirectory}/${n.local}"
(pkgs.writeText "nextcloud-unsynced-folders.txt" (lib.strings.concatLines n.unsyncedFolders))
] ]
} }
'')) ''))
@ -101,6 +103,11 @@ in
description = "Remote path to sync"; description = "Remote path to sync";
default = "/"; default = "/";
}; };
unsyncedFolders = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "Folders not to sync";
default = [];
};
}; };
} }
) )