From d290c309f40dff0e8e38f610ea20340cabac488e Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sat, 7 Oct 2023 20:57:11 -0400 Subject: nixos/network-interfaces-systemd: fix WakeOnLan WakeOnLan= was configured when using the scripted backend but not the networkd backend. The other link options are set in the .network file when using networkd, but WakeOnLan= is only available in a .link file. --- nixos/modules/tasks/network-interfaces-systemd.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nixos/modules/tasks') diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix index 53097e21c64..1ef168d6079 100644 --- a/nixos/modules/tasks/network-interfaces-systemd.nix +++ b/nixos/modules/tasks/network-interfaces-systemd.nix @@ -389,6 +389,16 @@ in }; }))) vlanNetworks + { + systemd.network.links = pipe interfaces [ + (filter (i: i.wakeOnLan.enable)) + (map (i: nameValuePair "40-${i.name}" { + matchConfig.OriginalName = i.name; + linkConfig.WakeOnLan = concatStringsSep " " i.wakeOnLan.policy; + })) + listToAttrs + ]; + } ]; # We need to prefill the slaved devices with networking options -- cgit 1.4.1 From f5f1751b1ffcd936fc5964c3075943ee39621cf2 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sat, 7 Oct 2023 21:02:46 -0400 Subject: refactor: combine scripted and networkd WakeOnLan config --- nixos/modules/tasks/network-interfaces-scripted.nix | 2 -- nixos/modules/tasks/network-interfaces-systemd.nix | 10 ---------- nixos/modules/tasks/network-interfaces.nix | 10 ++++++++++ 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'nixos/modules/tasks') diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 67ef152c4b6..da4aa916d65 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -61,8 +61,6 @@ let MACAddress = i.macAddress; } // optionalAttrs (i.mtu != null) { MTUBytes = toString i.mtu; - } // optionalAttrs (i.wakeOnLan.enable == true) { - WakeOnLan = concatStringsSep " " i.wakeOnLan.policy; }; }; in listToAttrs (map createNetworkLink interfaces); diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix index 1ef168d6079..53097e21c64 100644 --- a/nixos/modules/tasks/network-interfaces-systemd.nix +++ b/nixos/modules/tasks/network-interfaces-systemd.nix @@ -389,16 +389,6 @@ in }; }))) vlanNetworks - { - systemd.network.links = pipe interfaces [ - (filter (i: i.wakeOnLan.enable)) - (map (i: nameValuePair "40-${i.name}" { - matchConfig.OriginalName = i.name; - linkConfig.WakeOnLan = concatStringsSep " " i.wakeOnLan.policy; - })) - listToAttrs - ]; - } ]; # We need to prefill the slaved devices with networking options diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index fe77a444595..27a1ee78c78 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -1460,6 +1460,16 @@ in ] ++ bridgeStp; + # Wake-on-LAN configuration is shared by the scripted and networkd backends. + systemd.network.links = pipe interfaces [ + (filter (i: i.wakeOnLan.enable)) + (map (i: nameValuePair "40-${i.name}" { + matchConfig.OriginalName = i.name; + linkConfig.WakeOnLan = concatStringsSep " " i.wakeOnLan.policy; + })) + listToAttrs + ]; + # The network-interfaces target is kept for backwards compatibility. # New modules must NOT use it. systemd.targets.network-interfaces = -- cgit 1.4.1