panacea/modules/power.nix

30 lines
745 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
{
2022-04-16 00:08:57 +02:00
# Enable the TLP daemon
2022-10-18 14:55:03 +02:00
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;
2022-12-25 13:28:27 +01:00
CPU_SCALING_MAX_FREQ_ON_BAT = 2000000;
2022-10-18 14:55:03 +02:00
};
};
2022-04-16 00:08:57 +02:00
2021-02-17 03:50:33 +01:00
# 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"
'';
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
};
# Prevent overheating of the CPU
services.thermald.enable = true;
}