nixos/modules/wake-on-lan.nix

26 lines
574 B
Nix
Raw Normal View History

2024-09-14 02:16:49 +00:00
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.snowhawk.wake-on-lan;
in
{
options.snowhawk.wake-on-lan = {
enable = mkEnableOption "wake-on-lan nixos module";
};
config = mkIf cfg.enable {
systemd.services.wakeonlan = {
description = "reenable wakeonlan every boot";
after = [ "network.target" ];
serviceConfig = {
Type = "simple";
RemainAfterExit = "true";
ExecStart = "${lib.getExe pkgs.ethtool} -s enp7s0 wol g";
};
wantedBy = [ "default.target" ];
};
};
}