nixos/wireguard-networkd: fix systemd credentials not working with multiple keys per interface

This patch fixes systemd credential loading for wireguard
with networkd not working when specifying more than one
credential per interface by properly flattening the resulting
multidimensional list instead of falling back on string concat
with a space.

Resolves #365402
This commit is contained in:
networkException
2024-12-15 19:22:33 +01:00
parent 14974d2add
commit 1fc937818d
@@ -14,7 +14,12 @@ let
mapAttrsToList
nameValuePair
;
inherit (lib.lists) concatMap concatLists filter;
inherit (lib.lists)
concatMap
concatLists
filter
flatten
;
inherit (lib.modules) mkIf;
inherit (lib.options) literalExpression mkOption;
inherit (lib.strings) hasInfix;
@@ -215,7 +220,9 @@ in
systemd.timers = mapAttrs' generateRefreshTimer refreshEnabledInterfaces;
systemd.services = (mapAttrs' generateRefreshService refreshEnabledInterfaces) // {
systemd-networkd.serviceConfig.LoadCredential = mapAttrsToList interfaceCredentials cfg.interfaces;
systemd-networkd.serviceConfig.LoadCredential = flatten (
mapAttrsToList interfaceCredentials cfg.interfaces
);
};
};
}