nixdots/system/roles/laptop/power/default.nix

38 lines
748 B
Nix
Raw Normal View History

2024-04-13 19:15:25 +00:00
{ pkgs, lib, config, ...}: let
inherit (lib) mkIf mkDefault;
deviceType = config.myOptions.device.roles.type;
acceptedTypes = ["laptop"];
in {
imports = [
./auto-cpufreq
];
2024-04-13 19:15:25 +00:00
config = mkIf (builtins.elem deviceType acceptedTypes) {
hardware.acpilight.enable = true;
2024-04-13 18:56:51 +00:00
2024-04-13 19:15:25 +00:00
environment.systemPackages = with pkgs; [
acpi
powertop
];
2024-04-13 18:56:51 +00:00
2024-04-13 19:15:25 +00:00
services = {
# handle ACPI events
acpid.enable = true;
2024-04-13 18:56:51 +00:00
2024-04-13 19:15:25 +00:00
# temperature target on battery
undervolt = {
tempBat = 65; # deg C
package = pkgs.undervolt;
};
2024-04-13 18:56:51 +00:00
};
2024-04-13 19:15:25 +00:00
boot = {
kernelModules = ["acpi_call"];
extraModulePackages = with config.boot.kernelPackages; [
acpi_call
cpupower
];
};
2024-04-13 18:56:51 +00:00
};
}