nixos/syncthing: add versioning
This commit is contained in:
parent
ae9846c339
commit
dcdf4cec3a
1 changed files with 64 additions and 0 deletions
|
@ -18,6 +18,7 @@ let
|
||||||
fsWatcherEnabled = folder.watch;
|
fsWatcherEnabled = folder.watch;
|
||||||
fsWatcherDelayS = folder.watchDelay;
|
fsWatcherDelayS = folder.watchDelay;
|
||||||
ignorePerms = folder.ignorePerms;
|
ignorePerms = folder.ignorePerms;
|
||||||
|
versioning = folder.versioning;
|
||||||
}) (filterAttrs (
|
}) (filterAttrs (
|
||||||
_: folder:
|
_: folder:
|
||||||
folder.enable
|
folder.enable
|
||||||
|
@ -220,6 +221,69 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
versioning = mkOption {
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
How to keep changed/deleted files with syncthing.
|
||||||
|
There are 4 different types of versioning with different parameters.
|
||||||
|
See https://docs.syncthing.net/users/versioning.html
|
||||||
|
'';
|
||||||
|
example = [
|
||||||
|
{
|
||||||
|
versioning = {
|
||||||
|
type = "simple";
|
||||||
|
params.keep = "10";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
versioning = {
|
||||||
|
type = "trashcan";
|
||||||
|
params.cleanoutDays = "1000";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
versioning = {
|
||||||
|
type = "staggered";
|
||||||
|
params = {
|
||||||
|
cleanInterval = "3600";
|
||||||
|
maxAge = "31536000";
|
||||||
|
versionsPath = "/syncthing/backup";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
versioning = {
|
||||||
|
type = "external";
|
||||||
|
params.versionsPath = pkgs.writers.writeBash "backup" ''
|
||||||
|
folderpath="$1"
|
||||||
|
filepath="$2"
|
||||||
|
rm -rf "$folderpath/$filepath"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
type = with types; nullOr (submodule {
|
||||||
|
options = {
|
||||||
|
type = mkOption {
|
||||||
|
type = enum [ "external" "simple" "staggered" "trashcan" ];
|
||||||
|
description = ''
|
||||||
|
Type of versioning.
|
||||||
|
See https://docs.syncthing.net/users/versioning.html
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
params = mkOption {
|
||||||
|
type = attrsOf (either str path);
|
||||||
|
description = ''
|
||||||
|
Parameters for versioning. Structure depends on versioning.type.
|
||||||
|
See https://docs.syncthing.net/users/versioning.html
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rescanInterval = mkOption {
|
rescanInterval = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
default = 3600;
|
default = 3600;
|
||||||
|
|
Loading…
Reference in a new issue