{
  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 = ''
        /home/horseman/nix-config/misc/startup.sh
      '';
      serviceConfig = {
        Type = "oneshot";
        User = "root";
      };
    };
  };
}
