Rework laptop battery/power optimization settings

This commit is contained in:
ItsDrike 2024-04-13 22:18:21 +02:00
parent dd00ed5f70
commit a0bba2e225
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
4 changed files with 133 additions and 37 deletions

View file

@ -3,6 +3,10 @@
deviceType = config.myOptions.device.roles.type;
acceptedTypes = ["laptop"];
in {
imports = [
./auto-cpufreq
];
config = mkIf (builtins.elem deviceType acceptedTypes) {
hardware.acpilight.enable = true;
@ -15,48 +19,11 @@ in {
# handle ACPI events
acpid.enable = true;
# allows changing system behavior based upon user-selected power profiles
power-profiles-daemon.enable = true;
# temperature target on battery
undervolt = {
tempBat = 65; # deg C
package = pkgs.undervolt;
};
# superior power management
auto-cpufreq = {
enable = true;
# define the profiles
# (you can manually switch between profiles using `powerprofilesctl` cmd)
settings = let
MHz = x: x * 1000;
in {
battery = {
governor = "powersave";
scaling_min_freq = mkDefault (MHz 1200);
scaling_max_freq = mkDefault (MHz 1800);
turbo = "never";
};
charger = {
governor = "performance";
scaling_min_freq = mkDefault (MHz 1800);
scaling_max_freq = mkDefault (MHz 3800);
turbo = "auto";
};
};
};
# DBus service that provides power management support to applications
upower = {
enable = true;
percentageLow = 15;
percentageCritical = 5;
percentageAction = 3;
criticalPowerAction = "Hibernate";
};
};
boot = {