diff options
author | Ingolf Wagner <contact@ingolf-wagner.de> | 2019-10-29 21:04:26 +0100 |
---|---|---|
committer | Lassulus <github@lassul.us> | 2019-11-12 19:29:18 +0100 |
commit | 69493cc67a7be9b7913ec5a69339995956fabc63 (patch) | |
tree | 44357cceed042a3e92ba659e39105b4e0ba8f807 /nixos | |
parent | 41a1d984634a70d29d498355fbb270a60d6f99b3 (diff) |
nixos/syncthing: simple versioning
add simple versioning. I did not add the other versioning
types because I did not understand most of them.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/syncthing.nix | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix index 165fd5970cf8..96b90021a810 100644 --- a/nixos/modules/services/networking/syncthing.nix +++ b/nixos/modules/services/networking/syncthing.nix @@ -18,6 +18,7 @@ let fsWatcherEnabled = folder.watch; fsWatcherDelayS = folder.watchDelay; ignorePerms = folder.ignorePerms; + versioning = folder.versioning; }) (filterAttrs ( _: folder: folder.enable @@ -220,6 +221,59 @@ 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#simple-file-versioning + ''; + 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" ]; + }; + params = mkOption { + type = attrsOf (either str path); + }; + }; + }); + }; + rescanInterval = mkOption { type = types.int; default = 3600; |