2021-01-26 22:59:57 +01:00
|
|
|
{
|
2022-03-10 21:52:12 +01:00
|
|
|
pkgs,
|
|
|
|
|
config,
|
|
|
|
|
...
|
|
|
|
|
}: let
|
|
|
|
|
suspend = pkgs.writers.writeDash "suspend" "${pkgs.systemd}/bin/systemctl suspend";
|
|
|
|
|
in {
|
|
|
|
|
imports = [<stockholm/krebs/3modules/power-action.nix>];
|
2021-01-26 22:59:57 +01:00
|
|
|
|
|
|
|
|
krebs.power-action = {
|
|
|
|
|
enable = true;
|
|
|
|
|
plans.suspend = {
|
2021-02-02 09:08:29 +01:00
|
|
|
upperLimit = 7;
|
2021-01-26 22:59:57 +01:00
|
|
|
lowerLimit = 0;
|
|
|
|
|
charging = false;
|
|
|
|
|
action = pkgs.writeDash "suspend-wrapper" ''
|
|
|
|
|
/run/wrappers/bin/sudo ${suspend}
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
user = config.users.users.me.name;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
security.sudo.extraConfig = ''
|
|
|
|
|
${config.krebs.power-action.user} ALL= (root) NOPASSWD: ${suspend}
|
|
|
|
|
'';
|
|
|
|
|
}
|