panacea/modules/power.nix

30 lines
694 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 = {
2023-01-13 21:21:36 +01:00
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 50;
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;
2023-01-13 21:21:36 +01:00
coreOffset = -120;
gpuOffset = -95;
2022-12-01 04:37:58 +01:00
};
# Prevent overheating of the CPU
services.thermald.enable = true;
}