mirror of
https://github.com/JaxTheWolf/nixos.git
synced 2026-04-01 02:00:22 +02:00
Fixup suspend-then-hibernate
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
services.thermald.enable = true; # Prevents overheating/throttling
|
services.thermald.enable = true;
|
||||||
services.power-profiles-daemon.enable = false;
|
services.power-profiles-daemon.enable = false;
|
||||||
services.tlp = {
|
services.tlp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -29,17 +30,25 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.logind = {
|
services.logind = {
|
||||||
# Use 'settings' for modern NixOS Unstable/Stable
|
|
||||||
settings = {
|
settings = {
|
||||||
Login = {
|
Login = {
|
||||||
HandleLidSwitch = "suspend-then-hibernate";
|
HandleLidSwitch = "suspend-then-hibernate";
|
||||||
HandleLidSwitchExternalPower = "suspend";
|
HandleLidSwitchExternalPower = "suspend";
|
||||||
HandleLidSwitchDocked = "ignore"; # Keeps external monitors alive
|
HandleLidSwitchDocked = "ignore";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.sleep.extraConfig = ''
|
systemd.sleep.extraConfig = ''
|
||||||
HibernateDelaySec=10min
|
HibernateDelaySec=5min
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
systemd.services.disable-problematic-wakeup = {
|
||||||
|
description = "Disable only specific noisy wakeup sources";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${pkgs.bash}/bin/bash -c 'for device in XHC RP09 RP10 RP13; do if grep -q \"$device.*enabled\" /proc/acpi/wakeup; then echo $device > /proc/acpi/wakeup; fi; done'";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user