57 lines
1.3 KiB
Nix
57 lines
1.3 KiB
Nix
# Power management configuration for the laptops
|
|
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}: {
|
|
powerManagement = {
|
|
enable = true;
|
|
cpuFreqGovernor = lib.mkDefault "performance";
|
|
powertop.enable = true; # Enable powertop auto tuning on startup
|
|
};
|
|
|
|
services = {
|
|
logind = {
|
|
lidSwitch = "suspend-then-hibernate";
|
|
lidSwitchDocked = "ignore";
|
|
# powerKey = "suspend-then-hibernate"; # Enable in 23.11
|
|
extraConfig = ''
|
|
HandlePowerKey=suspend-then-hibernate
|
|
IdleAction=suspend-then-hibernate
|
|
IdleActionSec=10m
|
|
'';
|
|
};
|
|
thermald.enable = true;
|
|
auto-cpufreq = {
|
|
enable = true;
|
|
settings = {
|
|
battery = {
|
|
governor = "powersave";
|
|
turbo = "never";
|
|
};
|
|
charger = {
|
|
governor = "performance";
|
|
turbo = "auto";
|
|
};
|
|
};
|
|
};
|
|
upower = {
|
|
enable = true; # Enable application power managemetn support
|
|
percentageCritical = 15;
|
|
percentageAction = 10;
|
|
criticalPowerAction = "Hibernate";
|
|
};
|
|
};
|
|
|
|
programs.xss-lock = {
|
|
enable = true;
|
|
lockerCommand = "${pkgs.xscreensaver}/bin/screensaver-command -lock";
|
|
extraOptions = [
|
|
"-n ${pkgs.libnotify}/bin/notify-send \"Locking screen now\""
|
|
"IdleAction=lock"
|
|
"IdleActionSec=5m"
|
|
];
|
|
};
|
|
}
|