From b991f1e4483a2356b351d97dcaafe7bfc9822331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Sun, 29 Aug 2021 11:14:55 +0200 Subject: [PATCH 1/2] syncthing: add autoAcceptFolders to devices config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub Sokołowski --- nixos/modules/services/networking/syncthing.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix index 2e92fe51e90a3c..2efb7a9ed9327d 100644 --- a/nixos/modules/services/networking/syncthing.nix +++ b/nixos/modules/services/networking/syncthing.nix @@ -9,7 +9,7 @@ let devices = mapAttrsToList (name: device: { deviceID = device.id; - inherit (device) name addresses introducer; + inherit (device) name addresses introducer autoAcceptFolders; }) cfg.devices; folders = mapAttrsToList ( _: folder: { @@ -149,6 +149,15 @@ in { ''; }; + autoAcceptFolders = mkOption { + type = types.bool; + default = false; + description = '' + Automatically create or share folders that this device advertises at the default path. + See . + ''; + }; + }; })); }; From 972a3654888f23f67caefa817889a0033d88a755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Sun, 29 Aug 2021 11:20:02 +0200 Subject: [PATCH 2/2] syncthing: add extraFlags option that adjust service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is useful for situations in which you might want to reset certain things using `--reset-database` or `--reset-deltas` or debug certain things using any of the debug options like `--debug-perf-stats`. Signed-off-by: Jakub Sokołowski --- nixos/modules/services/networking/syncthing.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix index 2efb7a9ed9327d..d775627014928f 100644 --- a/nixos/modules/services/networking/syncthing.nix +++ b/nixos/modules/services/networking/syncthing.nix @@ -434,6 +434,15 @@ in { defaultText = literalExample "dataDir${optionalString cond " + \"/.config/syncthing\""}"; }; + extraFlags = mkOption { + type = types.listOf types.str; + default = []; + example = [ "--reset-deltas" ]; + description = '' + Extra flags passed to the syncthing command in the service definition. + ''; + }; + openDefaultPorts = mkOption { type = types.bool; default = false; @@ -526,7 +535,7 @@ in { ${cfg.package}/bin/syncthing \ -no-browser \ -gui-address=${cfg.guiAddress} \ - -home=${cfg.configDir} + -home=${cfg.configDir} ${escapeShellArgs cfg.extraFlags} ''; MemoryDenyWriteExecute = true; NoNewPrivileges = true;