nixos/syncthing: fix folder device ID name resolution

This restores the folder (device name -> device ID) resolution the declarative folder
settings depend on, which was removed in 95e51031b4
and resulted in the following tests failing:
- syncthing-folders
- syncthing-init

As well as broke eval of the NixOS module when any folders were defined
through attribute sets and broke runtime when folders were defined
through strings.

Fixes the regression introduced in: #529449
This commit is contained in:
a-kenji
2026-06-14 22:33:31 +02:00
parent 8cbc2e9e16
commit 458f4ef48e
@@ -46,6 +46,19 @@ let
folders = lib.pipe cfg.settings.folders [
(lib.filterAttrs (_: folder: folder.enable))
builtins.attrValues
(map (
folder:
folder
// {
devices = map (
device:
if builtins.isString device then
{ deviceId = cfg.settings.devices.${device}.id; }
else
{ deviceId = cfg.settings.devices.${device.name}.id; } // device
) folder.devices;
}
))
];
jq = "${pkgs.jq}/bin/jq";