diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index 3697b3bb2e3e..64e2c427da94 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -34,6 +34,8 @@ - `services.firezone.server.provision` has been removed due to it being unmaintanable. Remove all uses of provisioning and use the WebUI to configure firezone. +- The `services.syncthing` module now updates the Syncthing REST API using partial updates (`PATCH`) instead of full replacements (`PUT`) for general settings. Updating these settings was broken and prone to errors after updates, see [#428808](https://github.com/NixOS/nixpkgs/issues/428808) and [#528889](https://github.com/NixOS/nixpkgs/issues/528889). As a result, settings modified manually through the Syncthing Web UI that are not explicitly defined in your Nix configuration will now persist across rebuilds. + ## Other Notable Changes {#sec-release-26.11-notable-changes} diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix index 6925950a048f..17594e8db9f9 100644 --- a/nixos/modules/services/networking/syncthing.nix +++ b/nixos/modules/services/networking/syncthing.nix @@ -312,7 +312,7 @@ let "defaults" ]) (map (subOption: '' - curl -X PUT -d ${ + curl -X PATCH -d ${ lib.escapeShellArg (builtins.toJSON cleanedConfig.${subOption}) } ${curlAddressArgs "/rest/config/${subOption}"} '')) @@ -323,11 +323,18 @@ let (lib.optionalString (cleanedConfig ? defaults) ( lib.pipe cleanedConfig.defaults [ builtins.attrNames - (map (subOption: '' - curl -X PUT -d ${ - lib.escapeShellArg (builtins.toJSON cleanedConfig.defaults.${subOption}) - } ${curlAddressArgs "/rest/config/defaults/${subOption}"} - '')) + (map ( + subOption: + let + # /rest/config/defaults/ignores only supports PUT + method = if subOption == "ignores" then "PUT" else "PATCH"; + in + '' + curl -X ${method} -d ${ + lib.escapeShellArg (builtins.toJSON cleanedConfig.defaults.${subOption}) + } ${curlAddressArgs "/rest/config/defaults/${subOption}"} + '' + )) (lib.concatStringsSep "\n") ] ))