|
1 |
| -{ pkgs, lib, ... } : |
2 |
| - |
3 | 1 | {
|
4 |
| - systemd.services.bugfixSuspend-GPP0 = { |
5 |
| - enable = lib.mkDefault true; |
6 |
| - description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)"; |
7 |
| - unitConfig = { |
8 |
| - Type = "oneshot"; |
9 |
| - }; |
10 |
| - serviceConfig = { |
11 |
| - User = "root"; # root may not be necessary |
12 |
| - # check for gppN, disable if enabled |
13 |
| - # lifted from https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay |
14 |
| - ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP0' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP0' > /proc/acpi/wakeup; fi'"; |
15 |
| - RemainAfterExit = "yes"; # required to not toggle when `nixos-rebuild switch` is ran |
16 |
| - |
17 |
| - }; |
18 |
| - wantedBy = ["multi-user.target"]; |
19 |
| - }; |
20 |
| - |
21 |
| - systemd.services.bugfixSuspend-GPP8 = { |
22 |
| - enable = lib.mkDefault true; |
23 |
| - description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)"; |
24 |
| - unitConfig = { |
25 |
| - Type = "oneshot"; |
26 |
| - }; |
27 |
| - serviceConfig = { |
28 |
| - User = "root"; |
29 |
| - ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP8' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP8' > /proc/acpi/wakeup; fi'"; |
30 |
| - RemainAfterExit = "yes"; |
31 |
| - }; |
32 |
| - wantedBy = ["multi-user.target"]; |
33 |
| - }; |
34 |
| - |
| 2 | + # Work around an issue causing the system to unsuspend immediately after suspend |
| 3 | + # and/or hang after suspend. |
| 4 | + # |
| 5 | + # See https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay |
| 6 | + # |
| 7 | + # Most suggestions elsewhere are to disable GPP0 and/or GPP8 using /proc/acpi/wakeup, but that is |
| 8 | + # inconvenient because it toggles. This does essentially the same thing using udev, which can set |
| 9 | + # the wakeup attribute to a specific value. |
| 10 | + services.udev.extraRules = '' |
| 11 | + ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1022", ATTR{device}=="0x1483", ATTR{power/wakeup}="disabled" |
| 12 | + ''; |
35 | 13 | }
|
0 commit comments