blob: ca4b2afe815dc5174f41d077ea35fa344dc586ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
{ config, pkgs, ... }:
let
suspend = pkgs.writeDash "suspend" ''
${pkgs.systemd}/bin/systemctl suspend
'';
in {
lass.power-action = {
enable = true;
plans.suspend = {
upperLimit = 10;
lowerLimit = 0;
charging = false;
action = pkgs.writeDash "suspend-wrapper" ''
/var/setuid-wrappers/sudo ${suspend}
'';
};
};
security.sudo.extraConfig = ''
${config.lass.power-action.user.name} ALL= (root) NOPASSWD: ${suspend}
'';
}
|