nixos/syncthing: use PATCH for config updates

This commit is contained in:
Seudonym
2026-06-12 17:03:42 +05:30
parent 511068bba9
commit f7d047601b
2 changed files with 15 additions and 6 deletions
@@ -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}
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
@@ -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")
]
))