28 lines
700 B
Nix
28 lines
700 B
Nix
{
|
|
writeShellApplication,
|
|
kmod,
|
|
}:
|
|
writeShellApplication {
|
|
name = "acer-battery-health-mode";
|
|
|
|
runtimeInputs = [kmod]; # contains insmod
|
|
|
|
text = ''
|
|
#/usr/bin/env sh
|
|
|
|
# Using following tool https://github.com/frederik-h/acer-wmi-battery.git
|
|
|
|
PROJECT_LOCATION=~/git/acer-wmi-battery
|
|
|
|
if [ "$1" == "enable" ]; then
|
|
sudo insmod "$PROJECT_LOCATION/acer-wmi-battery.ko" enable_health_mode=1
|
|
echo "Battery health mode enabled"
|
|
elif [ "$1" == "disable" ]; then
|
|
sudo insmod "$PROJECT_LOCATION/acer-wmi-battery.ko" enable_health_mode=0
|
|
echo "Battery health mode disabled"
|
|
else
|
|
echo "Please either state 'enable' or 'disable'"
|
|
fi
|
|
'';
|
|
}
|