phhoebe: attempt to add 80% battery charge control

This commit is contained in:
Payas Relekar 2023-10-01 22:53:35 +05:30
parent e84677dc87
commit 39548aafab

View file

@ -54,4 +54,17 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
systemd.services.battery-charge-threshold = {
wantedBy = [ "local-fs.target" "suspend.target" ];
after = [ "local-fs.target" "suspend.target" ];
description = "Set the battery charge threshold to 80%";
startLimitBurst = 5;
startLimitIntervalSec = 1;
serviceConfig = {
Type = "oneshot";
Restart = "on-failure";
ExecStart = "${pkgs.runtimeShell} -c 'echo 80 > /sys/class/power_supply/BAT?/charge_control_end_threshold'";
};
};
}