2020-09-03 02:36:09 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
2022-04-16 00:08:57 +02:00
|
|
|
# Enable the TLP daemon
|
2023-01-20 21:48:16 +01:00
|
|
|
services.tlp = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
PCIE_ASPM_ON_AC = "performance";
|
|
|
|
PCIE_ASPM_ON_BAT = "powersupersave";
|
|
|
|
};
|
|
|
|
};
|
2023-01-19 15:27:08 +01:00
|
|
|
|
|
|
|
# Enable the auto-cpufreq daemon
|
|
|
|
services.auto-cpufreq.enable = true;
|
2022-04-16 00:08:57 +02:00
|
|
|
|
2023-01-19 12:52:49 +01:00
|
|
|
# Suspend when the battery is critical and autosuspend USB and PCI
|
2021-02-17 03:50:33 +01:00
|
|
|
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"
|
2023-01-19 12:52:49 +01:00
|
|
|
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"
|
|
|
|
ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="auto"
|
2021-02-17 03:50:33 +01:00
|
|
|
'';
|
2022-06-23 23:31:16 +02:00
|
|
|
|
2022-12-01 04:37:58 +01:00
|
|
|
# Undervolt CPU and GPU
|
|
|
|
services.undervolt = {
|
|
|
|
enable = true;
|
2022-12-03 14:08:49 +01:00
|
|
|
coreOffset = -100;
|
|
|
|
gpuOffset = -75;
|
2022-12-01 04:37:58 +01:00
|
|
|
};
|
2023-01-13 19:31:22 +01:00
|
|
|
|
|
|
|
# Prevent overheating of the CPU
|
|
|
|
services.thermald.enable = true;
|
2023-01-19 12:52:49 +01:00
|
|
|
|
|
|
|
# Provide power management support to programs
|
|
|
|
services.upower.enable = true;
|
|
|
|
|
|
|
|
# HACK Enable internal microphone when headphones are plugged in and add workaround for frequent WiFi disconnects
|
|
|
|
hardware.firmware = [
|
|
|
|
(pkgs.writeTextDir "/lib/firmware/hda-jack-retask.fw" ''
|
|
|
|
[codec]
|
|
|
|
0x10ec0293 0x17aa2233 0
|
|
|
|
|
|
|
|
[pincfg]
|
|
|
|
0x12 0x90a60130
|
|
|
|
0x13 0x40000000
|
|
|
|
0x14 0x90170110
|
|
|
|
0x15 0x03211040
|
|
|
|
0x16 0x21211010
|
|
|
|
0x18 0x411111f0
|
|
|
|
0x19 0x21a11010
|
|
|
|
0x1a 0x40f000f0
|
|
|
|
0x1b 0x411111f0
|
|
|
|
0x1d 0x40738105
|
|
|
|
0x1e 0x411111f0
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
|
|
|
# Power saving features for multiple devices
|
|
|
|
boot.extraModprobeConfig = ''
|
|
|
|
options snd-hda-intel patch=hda-jack-retask.fw power_save=1
|
|
|
|
options mac80211 beacon_loss_count=500
|
|
|
|
options iwlwifi power_save=1 uapsd_disable=0
|
|
|
|
options iwlmvm power_scheme=3
|
|
|
|
'';
|
|
|
|
|
2020-09-03 02:36:09 +02:00
|
|
|
}
|