panacea/modules/power.nix

14 lines
568 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
{
2024-01-05 21:30:49 +01:00
# Enable power-profiles-daemon
services.power-profiles-daemon.enable = true;
2022-04-16 00:08:57 +02:00
2023-01-19 12:52:49 +01:00
# Suspend when the battery is critical and autosuspend USB and PCI
2021-02-17 03:50:33 +01:00
services.udev.extraRules = ''
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{model_name}=="01AV405", ATTR{capacity}=="[0-5]", RUN+="${config.systemd.package}/bin/systemctl suspend -i"
2023-01-19 12:52:49 +01:00
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="auto"
2021-02-17 03:50:33 +01:00
'';
}