l 2: add power-action.nix
This commit is contained in:
parent
1b238cf556
commit
b408721046
23
lass/2configs/power-action.nix
Normal file
23
lass/2configs/power-action.nix
Normal file
@ -0,0 +1,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}
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user