2024-05-04 23:15:57 +03:00
|
|
|
# ThinkPad charge limits.
|
|
|
|
{ pkgs, lib, ... } @args: let
|
|
|
|
controlFileMin = "/sys/class/power_supply/BAT0/charge_control_start_threshold";
|
|
|
|
controlFileMax = "/sys/class/power_supply/BAT0/charge_control_end_threshold";
|
|
|
|
|
|
|
|
onMin = "40";
|
|
|
|
onMax = "80";
|
|
|
|
offMin = "90";
|
|
|
|
offMax = "95";
|
|
|
|
|
|
|
|
script = pkgs.writeShellScriptBin "powerlimit" (import ./powerlimit/Script.nix {
|
2024-05-12 02:40:37 +03:00
|
|
|
inherit controlFileMax controlFileMin onMin onMax offMin offMax;
|
2024-05-04 23:15:57 +03:00
|
|
|
}).script;
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
(import ./powerlimit ({
|
2024-05-12 02:40:37 +03:00
|
|
|
inherit controlFileMax controlFileMin onMin onMax offMin offMax;
|
2024-05-04 23:15:57 +03:00
|
|
|
} // args))
|
|
|
|
];
|
|
|
|
|
|
|
|
environment.systemPackages = [ script ];
|
|
|
|
}
|