mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
add(systemd): battery charge limitor
This commit is contained in:
parent
14d4090ed3
commit
ef2ab82bf6
2 changed files with 28 additions and 8 deletions
18
nix/hosts/thinkpad/battery.nix
Normal file
18
nix/hosts/thinkpad/battery.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{pkgs, ...}: {
|
||||
systemd.services.battery-charge-threshold = {
|
||||
enable = true;
|
||||
description = "Set the battery charge threshold";
|
||||
unitConfig = {
|
||||
After = "multi-user.target";
|
||||
StartLimitBurst = 0;
|
||||
};
|
||||
serviceConfig = {
|
||||
User = "root";
|
||||
Group = "root";
|
||||
Type = "oneshot";
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${pkgs.bash}/bin/bash -c 'echo 70 > /sys/class/power_supply/BAT1/charge_control_start_threshold; echo 80 > /sys/class/power_supply/BAT1/charge_control_end_threshold'";
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue