modularize thinkpad hw config
This commit is contained in:
parent
6d4453b618
commit
79368eafd5
5 changed files with 92 additions and 66 deletions
23
modules/hardware/battery-power.nix
Normal file
23
modules/hardware/battery-power.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
powerManagement.powertop.enable = true;
|
||||
|
||||
services = {
|
||||
udev.extraRules = ''
|
||||
#ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"
|
||||
ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="auto"
|
||||
SUBSYSTEM=="power_supply", ACTION=="change", RUN+="${pkgs.writeShellScript "battery-thresholds" ''
|
||||
echo 80 > /sys/class/power_supply/BAT1/charge_control_start_threshold || true
|
||||
echo 85 > /sys/class/power_supply/BAT1/charge_control_end_threshold || true
|
||||
''}"
|
||||
'';
|
||||
upower = {
|
||||
enable = true;
|
||||
percentageCritical = 15;
|
||||
percentageAction = 10;
|
||||
usePercentageForPolicy = true;
|
||||
allowRiskyCriticalPowerAction = true;
|
||||
criticalPowerAction = "HybridSleep";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue