Files
nix-config/hosts/common/optional/thermal-management.nix
2025-06-03 17:12:32 -03:00

67 lines
2.5 KiB
Nix

{
services.thermald.enable = true;
services.tlp = {
enable = true;
settings = {
# Set CPU driver operation mode to 'active' to allow the CPU to manage its own frequency scaling
CPU_DRIVER_OPMODE_ON_AC = "active";
CPU_DRIVER_OPMODE_ON_BAT = "active";
# Use 'powersave' governor, which, with intel_pstate in active mode, allows HWP to manage frequencies efficiently
CPU_SCALING_GOVERNOR_ON_AC = "powersave";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
# Set Energy Performance Preference (EPP) to balance performance on AC and favor power savings on battery
CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power";
# Define CPU performance limits: full performance on AC, limited to 50% on battery to save power
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 50;
# Enable Turbo Boost on AC for maximum performance; disable on battery to conserve energy
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
# Enable Intel's Hardware P-States (HWP) dynamic boost on AC; disable on battery
CPU_HWP_DYN_BOOST_ON_AC = 1;
CPU_HWP_DYN_BOOST_ON_BAT = 1;
# Set platform profile to 'performance' on AC and 'low-power' on battery, if supported by the system
PLATFORM_PROFILE_ON_AC = "balanced";
PLATFORM_PROFILE_ON_BAT = "low-power";
# Enable Wi-Fi power saving on both AC and battery
WIFI_PWR_ON_AC = "on";
WIFI_PWR_ON_BAT = "on";
# Configure PCIe Active State Power Management: default on AC, aggressive power saving on battery
PCIE_ASPM_ON_AC = "default";
PCIE_ASPM_ON_BAT = "powersupersave";
# Enable runtime power management for PCIe devices: 'on' for AC, 'auto' for battery
RUNTIME_PM_ON_AC = "on";
RUNTIME_PM_ON_BAT = "auto";
# Enable sound power saving on both AC and battery; '1' sets a 1-second timeout
SOUND_POWER_SAVE_ON_AC = 1;
SOUND_POWER_SAVE_ON_BAT = 1;
SOUND_POWER_SAVE_CONTROLLER = "Y";
# Enable USB autosuspend to save power when devices are idle
USB_AUTOSUSPEND = 1;
#Optional helps save long term battery health
#START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge
#STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
};
};
#powerManagement.powertop.enable = true;
services.power-profiles-daemon.enable = false;
}