panacea/modules/power.nix

30 lines
694 B
Nix

{ config, lib, pkgs, ... }:
{
# Enable the TLP daemon
services.tlp = {
enable = true;
settings = {
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 50;
};
};
# 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;
}