1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/power-action.nix

27 lines
539 B
Nix
Raw Normal View History

{
2022-03-10 21:52:12 +01:00
pkgs,
config,
...
2025-12-27 22:22:54 +01:00
}:
let
2022-03-10 21:52:12 +01:00
suspend = pkgs.writers.writeDash "suspend" "${pkgs.systemd}/bin/systemctl suspend";
2025-12-27 22:22:54 +01:00
in
{
2023-03-26 19:24:38 +02:00
services.power-action = {
enable = true;
plans.suspend = {
2021-02-02 09:08:29 +01:00
upperLimit = 7;
lowerLimit = 0;
charging = false;
action = pkgs.writers.writeDash "suspend-wrapper" ''
/run/wrappers/bin/sudo ${suspend}
'';
};
user = config.users.users.me.name;
};
security.sudo.extraConfig = ''
2023-03-26 19:24:38 +02:00
${config.services.power-action.user} ALL= (root) NOPASSWD: ${suspend}
'';
}