diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 24f0c37acf90..67ef152c4b65 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -62,7 +62,7 @@ let } // optionalAttrs (i.mtu != null) { MTUBytes = toString i.mtu; } // optionalAttrs (i.wakeOnLan.enable == true) { - WakeOnLan = "magic"; + WakeOnLan = concatStringsSep " " i.wakeOnLan.policy; }; }; in listToAttrs (map createNetworkLink interfaces); diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 0d4033ca9430..fe77a444595a 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -327,6 +327,24 @@ let default = false; description = lib.mdDoc "Whether to enable wol on this interface."; }; + policy = mkOption { + type = with types; listOf ( + enum ["phy" "unicast" "multicast" "broadcast" "arp" "magic" "secureon"] + ); + default = ["magic"]; + description = lib.mdDoc '' + The [Wake-on-LAN policy](https://www.freedesktop.org/software/systemd/man/systemd.link.html#WakeOnLan=) + to set for the device. + + The options are + - `phy`: Wake on PHY activity + - `unicast`: Wake on unicast messages + - `multicast`: Wake on multicast messages + - `broadcast`: Wake on broadcast messages + - `arp`: Wake on ARP + - `magic`: Wake on receipt of a magic packet + ''; + }; }; };