From c052813f6df2a93e9b57017c3067e34187bb4506 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:54:08 -0400 Subject: [PATCH] only toggle sleep mobo fix if needed --- modules/nixos/hardware/sleep.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/nixos/hardware/sleep.nix b/modules/nixos/hardware/sleep.nix index b760b72..342aa80 100644 --- a/modules/nixos/hardware/sleep.nix +++ b/modules/nixos/hardware/sleep.nix @@ -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