From e9bcb7bfdfed0f97c0c52fd8212814ce51d53944 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 19 Jan 2023 12:52:49 +0100 Subject: [PATCH] Increase power saving measures --- configuration.nix | 5 ++++- modules/power.nix | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/configuration.nix b/configuration.nix index b133e63..2a3fac5 100644 --- a/configuration.nix +++ b/configuration.nix @@ -12,9 +12,12 @@ with pkgs; "workqueue.power_efficient=y" "nohibernate" "ipv6.disable=1" + "ahci.mobile_lpm_policy=3" + "pcie_aspm=force" + "nmi_watchdog=0" ]; kernelModules = [ "i915" ]; - blacklistedKernelModules = [ "btusb" ]; + blacklistedKernelModules = [ "btusb" "bluetooth" ]; supportedFilesystems = [ "zfs" ]; zfs = { requestEncryptionCredentials = true; diff --git a/modules/power.nix b/modules/power.nix index b6cdce1..2099969 100644 --- a/modules/power.nix +++ b/modules/power.nix @@ -12,9 +12,11 @@ }; }; - # Suspend when the battery is critical + # Suspend when the battery is critical and autosuspend USB and PCI services.udev.extraRules = '' SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{model_name}=="01AV405", ATTR{capacity}=="[0-5]", RUN+="${config.systemd.package}/bin/systemctl suspend -i" + ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto" + ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="auto" ''; # Undervolt CPU and GPU @@ -26,4 +28,11 @@ # Prevent overheating of the CPU services.thermald.enable = true; + + # Provide power management support to programs + services.upower.enable = true; + + # Turn off keyboard backlight when unused + services.tp-auto-kbbl.enable = true; + }