nix-config/modules/timers/wol.nix
2026-03-26 00:19:31 +01:00

32 lines
620 B
Nix

{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.horseman.timers.wol;
in {
options = {
horseman.timers.wol = {
enable = mkEnableOption "Enables Wake on LAN on boot";
};
};
config = mkIf cfg.enable {
systemd.timers."enable-wol" = {
wantedBy = ["timers.target"];
timerConfig = {
OnBootSec = "10s";
Unit = "enable-wol.service";
};
};
systemd.services."enable-wol" = {
script = builtins.readFile ../../misc/startup.sh;
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
};
}