myNixosFlake/nixos/modules/hardware/battery-threshold.nix
2024-10-14 18:43:31 +03:00

21 lines
408 B
Nix

{ ... }:
{
systemd.services.setBatteryChargeThreshold = {
description = "Set the battery charge threshold";
after = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
Restart = "on-failure";
};
startLimitBurst = 0;
script = ''
echo 60 > /sys/class/power_supply/BAT0/charge_control_end_threshold
'';
wantedBy = [ "multi-user.target" ];
};
}