only toggle sleep mobo fix if needed

This commit is contained in:
Noah Masur 2023-06-01 22:54:08 -04:00
parent ed19eaafd1
commit c052813f6d

View File

@ -1,4 +1,4 @@
{ config, lib, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf config.physical {
@ -6,12 +6,12 @@
powerManagement.powerDownCommands = ''
set +e
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-*/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
# Disable if enabled
if (grep "GPP0.*enabled" /proc/acpi/wakeup >/dev/null); then
echo GPP0 | ${pkgs.doas}/bin/doas tee /proc/acpi/wakeup
fi
sleep 2