dotfiles/modules/nixos/hardware/sleep.nix

22 lines
605 B
Nix
Raw Normal View History

2022-12-21 21:18:03 +00:00
{ config, pkgs, lib, ... }: {
2022-12-21 21:18:03 +00:00
config = lib.mkIf (config.physical && pkgs.stdenv.isLinux) {
# 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
for power in /sys/bus/i2c/devices/i2c-*/device/power; do echo disabled > ''${power}/wakeup || true; done
for power in /sys/bus/usb/devices/1-*/device/power; do echo disabled > ''${power}/wakeup || true; done
# Fix for Gigabyte motherboard
# /r/archlinux/comments/y7b97e/my_computer_wakes_up_immediately_after_i_suspend/isu99sr/
echo GPP0 > /proc/acpi/wakeup
2022-12-21 21:18:03 +00:00
2023-04-02 00:21:26 +00:00
set -e
'';
2023-02-23 04:46:24 +00:00
2022-12-21 21:18:03 +00:00
};
}