1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-23 03:19:42 +01:00

Changed asus battery script to work with multiple battery names.

Signed-off-by: Aidan Pinard <aidan@aidanpinard.co>
This commit is contained in:
Aidan Pinard 2022-11-09 08:47:07 -04:00
parent f6483e0def
commit 191d3ca91d
No known key found for this signature in database
GPG key ID: C48B088F4FFBBDF0

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
p = pkgs.writeScriptBin "charge-upto" '' p = pkgs.writeScriptBin "charge-upto" ''
echo ''${0:-100} > /sys/class/power_supply/BAT0/charge_control_end_threshold echo ''${0:-100} > /sys/class/power_supply/BAT?/charge_control_end_threshold
''; '';
cfg = config.hardware.asus.battery; cfg = config.hardware.asus.battery;
in in
@ -30,7 +30,7 @@ in
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
Restart = "on-failure"; Restart = "on-failure";
ExecStart = "${pkgs.runtimeShell} -c 'echo ${toString cfg.chargeUpto} > /sys/class/power_supply/BAT0/charge_control_end_threshold'"; ExecStart = "${pkgs.runtimeShell} -c 'echo ${toString cfg.chargeUpto} > /sys/class/power_supply/BAT?/charge_control_end_threshold'";
}; };
}; };
}; };