2021-05-09 06:34:31 +00:00
|
|
|
# Power management configuration for the laptops
|
|
|
|
{
|
2022-03-07 14:26:15 +00:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: {
|
2021-05-09 06:34:31 +00:00
|
|
|
powerManagement = {
|
|
|
|
enable = true;
|
|
|
|
cpuFreqGovernor = lib.mkDefault "performance";
|
2021-11-16 04:57:23 +00:00
|
|
|
powertop.enable = true; # Enable powertop auto tuning on startup
|
2021-05-09 06:34:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
2021-05-13 01:36:54 +00:00
|
|
|
logind = {
|
2023-12-05 02:48:58 +00:00
|
|
|
lidSwitch = "suspend-then-hibernate";
|
2021-09-03 11:55:08 +00:00
|
|
|
lidSwitchDocked = "ignore";
|
2024-05-22 11:56:57 +00:00
|
|
|
# powerKey = "suspend-then-hibernate"; # Enable in 23.11
|
|
|
|
extraConfig = ''
|
|
|
|
HandlePowerKey=suspend-then-hibernate
|
|
|
|
IdleAction=suspend-then-hibernate
|
|
|
|
IdleActionSec=10m
|
|
|
|
'';
|
2021-05-13 01:36:54 +00:00
|
|
|
};
|
2023-12-05 02:48:58 +00:00
|
|
|
thermald.enable = true;
|
2021-05-09 06:34:31 +00:00
|
|
|
upower = {
|
2021-11-16 04:57:23 +00:00
|
|
|
enable = true; # Enable application power managemetn support
|
2021-05-25 06:27:55 +00:00
|
|
|
percentageCritical = 15;
|
2021-11-28 21:27:44 +00:00
|
|
|
percentageAction = 10;
|
|
|
|
criticalPowerAction = "Hibernate";
|
2021-05-09 06:34:31 +00:00
|
|
|
};
|
|
|
|
};
|
2024-05-22 11:56:57 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
];
|
|
|
|
};
|
2021-05-09 06:34:31 +00:00
|
|
|
}
|