{ lib, myConfig, ... }:

with lib;
let
  cfg = myConfig.wakeup.mouse or {};
in
{
  config = mkIf (cfg.disable or false && cfg.vendor != null && cfg.product != null) {
    services.udev.extraRules = ''
      # Disable wakeup for mouse configured in config.nix
      ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="${cfg.vendor}", ATTRS{idProduct}=="${cfg.product}", ATTR{power/wakeup}="disabled"
    '';
  };
}
