mirror of
https://github.com/ItsDrike/nixdots
synced 2025-06-30 21:00:42 +00:00
Rework laptop battery/power optimization settings
This commit is contained in:
parent
dd00ed5f70
commit
a0bba2e225
4 changed files with 133 additions and 37 deletions
47
system/roles/laptop/power/auto-cpufreq/default.nix
Normal file
47
system/roles/laptop/power/auto-cpufreq/default.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
# This sets up power management using auto-cpufreq,
|
||||
# alongside with upower and power-profiles-daemon.
|
||||
# Together, this provides a complete alternative to TLP
|
||||
{ pkgs, lib, config, ...}: let
|
||||
inherit (lib) mkIf mkDefault;
|
||||
deviceType = config.myOptions.device.roles.type;
|
||||
acceptedTypes = ["laptop"];
|
||||
in {
|
||||
imports = [
|
||||
./power-profiles-daemon
|
||||
];
|
||||
|
||||
config = mkIf (builtins.elem deviceType acceptedTypes) {
|
||||
services = {
|
||||
# superior power management
|
||||
auto-cpufreq = {
|
||||
enable = true;
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue