From 1fc937818d2919cf83e78a2e1357537f820db9ea Mon Sep 17 00:00:00 2001 From: networkException Date: Sun, 15 Dec 2024 19:13:48 +0100 Subject: [PATCH] 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 --- .../services/networking/wireguard-networkd.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/wireguard-networkd.nix b/nixos/modules/services/networking/wireguard-networkd.nix index 931f3305594c..ad7de97f1e5a 100644 --- a/nixos/modules/services/networking/wireguard-networkd.nix +++ b/nixos/modules/services/networking/wireguard-networkd.nix @@ -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 + ); }; }; }