2024-04-20 13:42:06 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
2022-05-12 00:30:16 +00:00
|
|
|
|
2023-07-18 02:00:38 +00:00
|
|
|
config = lib.mkIf (config.physical && !config.server) {
|
2022-12-21 21:18:03 +00:00
|
|
|
|
|
|
|
# Prevent wake from keyboard
|
|
|
|
powerManagement.powerDownCommands = ''
|
2023-04-02 00:21:26 +00:00
|
|
|
set +e
|
2023-02-23 04:46:24 +00:00
|
|
|
|
2023-04-02 00:21:26 +00:00
|
|
|
# Fix for Gigabyte motherboard
|
|
|
|
# /r/archlinux/comments/y7b97e/my_computer_wakes_up_immediately_after_i_suspend/isu99sr/
|
2023-06-02 02:54:08 +00:00
|
|
|
# Disable if enabled
|
|
|
|
if (grep "GPP0.*enabled" /proc/acpi/wakeup >/dev/null); then
|
|
|
|
echo GPP0 | ${pkgs.doas}/bin/doas tee /proc/acpi/wakeup
|
|
|
|
fi
|
2022-12-21 21:18:03 +00:00
|
|
|
|
2023-04-15 14:11:30 +00:00
|
|
|
sleep 2
|
|
|
|
|
2023-04-02 00:21:26 +00:00
|
|
|
set -e
|
|
|
|
'';
|
2023-02-23 04:46:24 +00:00
|
|
|
|
2023-04-02 12:22:28 +00:00
|
|
|
services.udev.extraRules = ''
|
|
|
|
ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usb", ATTR{power/wakeup}="disabled"
|
|
|
|
ACTION=="add", SUBSYSTEM=="i2c", ATTR{power/wakeup}="disabled"
|
|
|
|
'';
|
2022-12-21 21:18:03 +00:00
|
|
|
};
|
2022-05-12 00:30:16 +00:00
|
|
|
}
|