File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
nixos/modules/services/networking Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 2929 deviceID = device . id ;
3030 } ) cfg . settings . devices ;
3131
32+ anyAutoAccept = builtins . any ( dev : dev . autoAcceptFolders ) devices ;
33+
3234 folders = mapAttrsToList ( _ : folder : folder //
3335 throwIf ( folder ?rescanInterval || folder ?watch || folder ?watchDelay ) ''
3436 The options services.syncthing.settings.folders.<name>.{rescanInterval,watch,watchDelay}
@@ -180,7 +182,12 @@ in {
180182
181183 overrideFolders = mkOption {
182184 type = types . bool ;
183- default = true ;
185+ default = ! anyAutoAccept ;
186+ defaultText = literalMD ''
187+ `true` unless any device has the
188+ [autoAcceptFolders](#opt-services.syncthing.settings.devices._name_.autoAcceptFolders)
189+ option set to `true`.
190+ '' ;
184191 description = ''
185192 Whether to delete the folders which are not configured via the
186193 [folders](#opt-services.syncthing.settings.folders) option.
@@ -620,6 +627,15 @@ in {
620627 ###### implementation
621628
622629 config = mkIf cfg . enable {
630+ assertions = [
631+ {
632+ assertion = ! ( cfg . overrideFolders && anyAutoAccept ) ;
633+ message = ''
634+ services.syncthing.overrideFolders will delete auto-accepted folders
635+ from the configuration, creating path conflicts.
636+ '' ;
637+ }
638+ ] ;
623639
624640 networking . firewall = mkIf cfg . openDefaultPorts {
625641 allowedTCPPorts = [ 22000 ] ;
You can’t perform that action at this time.
0 commit comments