0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

network.interfaces: Add option to configure WakeOnLan policy

Adds an option to configure a custom WakeOnLan policy instead of the
hard-coded "magic" policy. To ensure compatibility with current
behavior, "magic" is kept as default.
This commit is contained in:
ign0tus 2023-09-28 20:06:28 +02:00
parent 237f7ba7d2
commit 27d0a8a0cd
2 changed files with 19 additions and 1 deletions

View file

@ -62,7 +62,7 @@ let
} // optionalAttrs (i.mtu != null) { } // optionalAttrs (i.mtu != null) {
MTUBytes = toString i.mtu; MTUBytes = toString i.mtu;
} // optionalAttrs (i.wakeOnLan.enable == true) { } // optionalAttrs (i.wakeOnLan.enable == true) {
WakeOnLan = "magic"; WakeOnLan = concatStringsSep " " i.wakeOnLan.policy;
}; };
}; };
in listToAttrs (map createNetworkLink interfaces); in listToAttrs (map createNetworkLink interfaces);

View file

@ -327,6 +327,24 @@ let
default = false; default = false;
description = lib.mdDoc "Whether to enable wol on this interface."; 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
'';
};
}; };
}; };