diff options
author | Aspen Smith <root@gws.fyi> | 2024-03-31T18·16-0400 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-03-31T18·34+0000 |
commit | d959358e1fc3d91519ee75cc702eacef2af2f935 (patch) | |
tree | fc99389a8d6c176db41d43b3c242d5b0a5780f17 /users/aspen/system/system/modules/reusable/battery.nix | |
parent | 1dd378b0b8f30b5701051b33512608d5b8ea6059 (diff) |
chore(aspen/system): Drop custom battery service in favor of upower r/7815
Change-Id: Ie3e5aeba7026724dacbe4d0dc15a1112a22c3670 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11304 Autosubmit: aspen <root@gws.fyi> Tested-by: BuildkiteCI Reviewed-by: aspen <root@gws.fyi>
Diffstat (limited to 'users/aspen/system/system/modules/reusable/battery.nix')
-rw-r--r-- | users/aspen/system/system/modules/reusable/battery.nix | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/users/aspen/system/system/modules/reusable/battery.nix b/users/aspen/system/system/modules/reusable/battery.nix deleted file mode 100644 index 151c2a246f32..000000000000 --- a/users/aspen/system/system/modules/reusable/battery.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; -{ - options = { - laptop.onLowBattery = { - enable = mkEnableOption "Perform action on low battery"; - - thresholdPercentage = mkOption { - description = "Threshold battery percentage on which to perform the action"; - default = 8; - type = types.int; - }; - - action = mkOption { - description = "Action to perform on low battery"; - default = "hibernate"; - type = types.enum [ "hibernate" "suspend" "suspend-then-hibernate" ]; - }; - }; - }; - - config = - let cfg = config.laptop.onLowBattery; - in mkIf cfg.enable { - services.udev.extraRules = concatStrings [ - ''SUBSYSTEM=="power_supply", '' - ''ATTR{status}=="Discharging", '' - ''ATTR{capacity}=="[0-${toString cfg.thresholdPercentage}]", '' - ''RUN+="${pkgs.systemd}/bin/systemctl ${cfg.action}"'' - ]; - }; -} |