From d1b659a55f069e67eb923eca547c25df858dbf00 Mon Sep 17 00:00:00 2001 From: Payas Relekar Date: Sun, 23 Jul 2023 22:03:00 +0530 Subject: [PATCH] Syncthing: try to update config per new options And also disable --- hosts/bebop/syncthing.nix | 2 +- hosts/hermes/syncthing.nix | 84 +++++++++++++-------------- modules/common-syncthing.nix | 107 ++++++++++++++++++----------------- 3 files changed, 100 insertions(+), 93 deletions(-) diff --git a/hosts/bebop/syncthing.nix b/hosts/bebop/syncthing.nix index 42a1875..be8c93c 100644 --- a/hosts/bebop/syncthing.nix +++ b/hosts/bebop/syncthing.nix @@ -47,7 +47,7 @@ Music = { devices = [ "hermes" "Childish Tycoon" ]; type = "receiveonly"; - watch = true; + fsWatcherEnabled = true; }; }; }; diff --git a/hosts/hermes/syncthing.nix b/hosts/hermes/syncthing.nix index 165d585..38f4c34 100644 --- a/hosts/hermes/syncthing.nix +++ b/hosts/hermes/syncthing.nix @@ -7,53 +7,55 @@ services.syncthing = { guiAddress = "127.0.0.1:8384"; - folders = { - Keepass = { - enable = true; - devices = [ "bebop" "Childish Tycoon" ]; - type = "sendreceive"; - watch = true; - versioning = { - type = "simple"; - params.keep = "5"; - }; - }; - - Syncthing = { - enable = true; - devices = [ "bebop" "Childish Tycoon" ]; - type = "sendreceive"; - watch = true; - versioning = { - type = "staggered"; - params = { - cleanInterval = "3600"; - maxAge = "31536000"; + settings = { + folders = { + "~/Keepass" = { + enable = true; + devices = [ "bebop" "Childish Tycoon" ]; + type = "sendreceive"; + fsWatcherEnabled = true; + versioning = { + type = "simple"; + params.keep = "5"; }; }; - }; - org = { - enable = true; - devices = [ "bebop" "Childish Tycoon" ]; - type = "sendreceive"; - watch = true; - }; + "~/Syncthing" = { + enable = true; + devices = [ "bebop" "Childish Tycoon" ]; + type = "sendreceive"; + fsWatcherEnabled = true; + versioning = { + type = "staggered"; + params = { + cleanInterval = "3600"; + maxAge = "31536000"; + }; + }; + }; - Music = { - enable = true; - devices = [ "bebop" "Childish Tycoon" ]; - type = "sendreceive"; - watch = true; - }; + "~/org" = { + enable = true; + devices = [ "bebop" "Childish Tycoon" ]; + type = "sendreceive"; + fsWatcherEnabled = true; + }; + + "~/Music" = { + enable = true; + devices = [ "bebop" "Childish Tycoon" ]; + type = "sendreceive"; + fsWatcherEnabled = true; + }; - Pictures = { - enable = false; - # Kept as future reminder - devices = [ ]; # no pause option in NixOS module, no sharing is as good as paused - type = "sendreceive"; - watch = false; # disabled folder, no need to watch + "~/Pictures" = { + enable = false; + # Kept as future reminder + devices = [ ]; # no pause option in NixOS module, no sharing is as good as paused + type = "sendreceive"; + fsWatcherEnabled = false; # disabled folder, no need to fsWatcherEnabled + }; }; }; }; diff --git a/modules/common-syncthing.nix b/modules/common-syncthing.nix index 73e3e81..99c9959 100644 --- a/modules/common-syncthing.nix +++ b/modules/common-syncthing.nix @@ -9,9 +9,10 @@ in # - Make ALL the nodes use this declaratively :) { services.syncthing = { - enable = true; + enable = false; openDefaultPorts = true; user = payas; + group = payas; configDir = "/home/${payas}/.config/syncthing/"; # Hosts can opt-out of folders with enable = false @@ -20,67 +21,71 @@ in # overrideFolders = true; overrideDevices = false; - extraOptions = { + settings = { + options = { + urAccepted = -1; + relaysEnabled = true; + limitBandwidthInLan = false; + localAnnounceEnabled = true; + }; + gui = { theme = "black"; }; - }; - devices = { - hermes = { - id = - "LYFSPF4-L6C24OM-IDYZAUT-5D32FAS-FCHN7FR-CUPWEEE-YOZYBQ3-RL5T5Q6"; - name = "hermes"; - introducer = false; # Only use declaratively configured devices + devices = { + hermes = { + id = + "LYFSPF4-L6C24OM-IDYZAUT-5D32FAS-FCHN7FR-CUPWEEE-YOZYBQ3-RL5T5Q6"; + name = "hermes"; + }; + + "Childish Tycoon" = { + id = + "ERSVP63-ASZCCJB-FWLSZ3N-MDZ4SV5-IXBP5QD-QK235LI-DY5BYRC-6NSWUQS"; + name = "Childish Tycoon"; + }; + + bebop = { + id = + "M6OJZSY-MPOQY76-BSZUFBQ-QK7LBM6-3YBOJZS-5H2K7UV-S6B34ON-THT3OAI"; + name = "bebop"; + }; }; - "Childish Tycoon" = { - id = - "ERSVP63-ASZCCJB-FWLSZ3N-MDZ4SV5-IXBP5QD-QK235LI-DY5BYRC-6NSWUQS"; - name = "Childish Tycoon"; - introducer = false; # Only use declaratively configured devices - }; + folders = { + # devices, type and versioning to be configured per-node + # Disable unwanted folder in per-node config - bebop = { - id = - "M6OJZSY-MPOQY76-BSZUFBQ-QK7LBM6-3YBOJZS-5H2K7UV-S6B34ON-THT3OAI"; - name = "bebop"; - introducer = false; # Only use declaratively configured devices - }; - }; + "~/Keepass" = { + id = "qsoil-jtfof"; + label = "Keepass"; + path = "/home/${payas}/Keepass"; + }; - folders = { - # devices, type and versioning to be configured per-node - # Disable unwanted folder in per-node config + "~/Syncthing" = { + id = "yg7in-0dlb8"; + label = "Syncthing"; + path = "/home/${payas}/Syncthing"; + }; - Keepass = { - id = "qsoil-jtfof"; - label = "Keepass"; - path = "/home/${payas}/Keepass"; - }; + "~/Music" = { + id = "3qsnr-wjn9w"; + label = "Music"; + path = "/home/${payas}/Music"; + }; - Syncthing = { - id = "yg7in-0dlb8"; - label = "Syncthing"; - path = "/home/${payas}/Syncthing"; - }; + "~/org" = { + id = "9ta3z-yrde3"; + label = "org"; + path = "/home/${payas}/org"; + }; - Music = { - id = "3qsnr-wjn9w"; - label = "Music"; - path = "/home/${payas}/Music"; - }; - - org = { - id = "9ta3z-yrde3"; - label = "org"; - path = "/home/${payas}/org"; - }; - - Pictures = { - id = "rjozc-vd3hh"; - label = "Pictures"; - path = "/home/${payas}/Pictures"; + "~/Pictures" = { + id = "rjozc-vd3hh"; + label = "Pictures"; + path = "/home/${payas}/Pictures"; + }; }; }; };