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
583 B
Nix
Raw Normal View History

{
2022-03-10 21:52:12 +01:00
pkgs,
config,
...
}: let
suspend = pkgs.writers.writeDash "suspend" "${pkgs.systemd}/bin/systemctl suspend";
in {
imports = [../modules/power-action.nix];
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 = ''
${config.services.power-action.user} ALL= (root) NOPASSWD: ${suspend}
'';
}