30 lines
745 B
Nix
30 lines
745 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
# Enable the TLP daemon
|
|
services.tlp = {
|
|
enable = true;
|
|
settings = {
|
|
CPU_SCALING_MIN_FREQ_ON_AC = 800000;
|
|
CPU_SCALING_MAX_FREQ_ON_AC = 3000000;
|
|
CPU_SCALING_MIN_FREQ_ON_BAT = 800000;
|
|
CPU_SCALING_MAX_FREQ_ON_BAT = 2000000;
|
|
};
|
|
};
|
|
|
|
# Suspend when the battery is critical
|
|
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"
|
|
'';
|
|
|
|
# Undervolt CPU and GPU
|
|
services.undervolt = {
|
|
enable = true;
|
|
coreOffset = -100;
|
|
gpuOffset = -75;
|
|
};
|
|
|
|
# Prevent overheating of the CPU
|
|
services.thermald.enable = true;
|
|
}
|