44 lines
1 KiB
Nix
44 lines
1 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;
|
|
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"
|
|
];
|
|
};
|
|
}
|