mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 09:17:14 +08:00 
			
		
		
		
	Changed asus battery script to work with multiple battery names.
Signed-off-by: Aidan Pinard <aidan@aidanpinard.co>
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
{ config, pkgs, lib, ... }:
 | 
			
		||||
let
 | 
			
		||||
  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;
 | 
			
		||||
in
 | 
			
		||||
@@ -30,7 +30,7 @@ in
 | 
			
		||||
      serviceConfig = {
 | 
			
		||||
        Type = "oneshot";
 | 
			
		||||
        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'";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user