diff --git a/modules/nixos/power.nix b/modules/nixos/power.nix index feafb5a..85e1faa 100644 --- a/modules/nixos/power.nix +++ b/modules/nixos/power.nix @@ -1,4 +1,21 @@ {pkgs, ...}: { - # USB wakeup configuration - Temporarily Disabled - # systemd.services.disable-usb-wakeups = { ... }; + # USB wakeup configuration + # Disabling USB wakeups to prevent accidental wakeups from mouse/keyboard/bluetooth + systemd.services.disable-usb-wakeups = { + description = "Disable USB wakeup triggers"; + wantedBy = ["multi-user.target" "post-resume.target"]; + after = ["post-resume.target"]; + serviceConfig = { + Type = "oneshot"; + ExecStart = pkgs.writeShellScript "disable-usb-wakeups" '' + for device in XHC0 XHC1 XHC2 XH00 GPP0 GPP7; do + if grep -q "$device.*enabled" /proc/acpi/wakeup; then + echo "Disabling wakeup for $device" + echo "$device" > /proc/acpi/wakeup + fi + done + ''; + RemainAfterExit = true; + }; + }; } \ No newline at end of file