summaryrefslogtreecommitdiffstats
path: root/lass/2configs
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2016-06-18 21:53:44 +0200
committerlassulus <lass@aidsballs.de>2016-06-18 21:53:44 +0200
commitb408721046b0c84047d25f54764775d32264906d (patch)
tree49aa792b8b5aaca30bc3e8492c3e5420d23dd598 /lass/2configs
parent1b238cf556064996b9db9b4a86c232228a0e9114 (diff)
l 2: add power-action.nix
Diffstat (limited to 'lass/2configs')
-rw-r--r--lass/2configs/power-action.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/lass/2configs/power-action.nix b/lass/2configs/power-action.nix
new file mode 100644
index 000000000..ca4b2afe8
--- /dev/null
+++ b/lass/2configs/power-action.nix
@@ -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}
+ '';
+}