Skip to content

Commit

Permalink
turingmachine: suspend on low-power
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Oct 17, 2023
1 parent d84dcf6 commit 6575c3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nixos/modules/suspend-on-low-power.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ config, ... }:
let
powerInPercent = 10;
in {
services.udev.extraRules = ''
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="${toString powerInPercent}", RUN+="${config.systemd.package}/bin/systemctl suspend"
'';
}
1 change: 1 addition & 0 deletions nixos/turingmachine/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
./modules/tum-vpn.nix
#./modules/minidlna.nix

../modules/suspend-on-low-power.nix
../modules/borgbackup.nix
../modules/nncp.nix
../modules/touchpad-hack
Expand Down

0 comments on commit 6575c3c

Please sign in to comment.