Files
ndots/openspec/changes/wake-on-lan/tasks.md
T
jpporta cdbad8910c Squashed commit of the following:
commit bf4873eb012235b4d82cd79c4f508064ead301ab
Author: Joao Porta <jpedro.porta@gmail.com>
Date:   Fri Jul 17 17:24:26 2026 -0300

    wake on lan
2026-07-17 17:25:16 -03:00

2.0 KiB

1. Create the WOL NixOS module

  • 1.1 Create modules/nixos/wake-on-lan/default.nix with a custom.wake-on-lan.enable option.
  • 1.2 Define a systemd oneshot service wol-enp14s0.service that runs ethtool -s enp14s0 wol g.
  • 1.3 Wire the unit's after/wants to network-online.target and NetworkManager.service so it runs after the link is up.
  • 1.4 Add the unit to the resume path so wol g is re-applied after suspend/resume (use systemd-suspend.service or a path unit hook).

2. Add packages and the convenience wrapper

  • 2.1 Add pkgs.ethtool and pkgs.wakeonlan to environment.systemPackages when the module is enabled. (Note: pkgs.iputils does not provide wakeonlan in nixpkgs — see implementation note.)
  • 2.2 Create a wake-jpporta-nixos shell script via pkgs.writeShellScriptBin that invokes wakeonlan -i ${1:-255.255.255.255} d8:43:ae:5a:ae:12.
  • 2.3 Add the wrapper to environment.systemPackages.

3. Wire the module into the host

  • 3.1 Add ../../modules/nixos/wake-on-lan to imports in hosts/jpporta-nixos/configuration.nix.
  • 3.2 Add custom.wake-on-lan.enable = true; under the existing custom = { ... }; block in the host config.

4. Verify and document

  • 4.1 Rebuild the system with sudo nixos-rebuild switch --flake .#jpporta-nixos.
  • 4.2 Run ethtool enp14s0 and confirm Supports Wake-on: lists g and Wake-on: g.
  • 4.3 Run systemctl status wol-enp14s0.service and confirm the unit is active (exited).
  • 4.4 Run wake-jpporta-nixos once while the machine is up to confirm the script runs without error (it will be a no-op when the host is already up).
  • 4.5 Shut the machine down, then run wake-jpporta-nixos from another machine on the same LAN and confirm jpporta-nixos powers on.
  • 4.6 Document the BIOS-level prerequisite ("Wake on LAN" enabled, "After Power Loss" → Power Off / Stay Off) in the change notes or a README so it's not lost.