refactor: combine scripted and networkd WakeOnLan config

This commit is contained in:
Majiir Paktu 2023-10-07 21:02:46 -04:00
parent d290c309f4
commit f5f1751b1f
3 changed files with 10 additions and 12 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 =