From bb3ea37eeed0da6dbd2c6a6c08abbdd16cf5f875 Mon Sep 17 00:00:00 2001 From: legendofmiracles Date: Fri, 1 Oct 2021 18:08:39 -0600 Subject: [PATCH] nixos/networking: add the wakeonlan option --- nixos/doc/manual/from_md/release-notes/rl-2111.section.xml | 7 +++++++ nixos/doc/manual/release-notes/rl-2111.section.md | 2 ++ nixos/modules/tasks/network-interfaces-scripted.nix | 2 ++ nixos/modules/tasks/network-interfaces.nix | 7 +++++++ 4 files changed, 18 insertions(+) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index 0688de77af68..64ada2c75344 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -326,6 +326,13 @@
Backward Incompatibilities + + + The services.wakeonlan option was removed, + and replaced with + networking.interfaces.<name>.wakeOnLan. + + The security.wrappers option now requires diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index 56babf8ac006..3018a26d520f 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -101,6 +101,8 @@ In addition to numerous new and upgraded packages, this release has the followin ## Backward Incompatibilities {#sec-release-21.11-incompatibilities} +- The `services.wakeonlan` option was removed, and replaced with `networking.interfaces..wakeOnLan`. + - The `security.wrappers` option now requires to always specify an owner, group and whether the setuid/setgid bit should be set. This is motivated by the fact that before NixOS 21.11, specifying either setuid or setgid but not owner/group resulted in wrappers owned by nobody/nogroup, which is unsafe. diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 11bd159319a3..79624ec7072c 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -61,6 +61,8 @@ let MACAddress = i.macAddress; } // optionalAttrs (i.mtu != null) { MTUBytes = toString i.mtu; + } // optionalAttrs (i.wakeOnLan.enable == true) { + WakeOnLan = "magic"; }; }; in listToAttrs (map createNetworkLink interfaces); diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 34a44b383a49..82893d91fbba 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -284,6 +284,13 @@ let ''; }; + wakeOnLan = { + enable = mkOption { + type = types.bool; + default = false; + description = "Wether to enable wol on this interface."; + }; + }; }; config = {