-{ config, lib, pkgs, ... }:
+{ pkgs, ... }:
{
-hardware.acpilight.enable = true;
-boot.kernelModules = [ "msr" "acpi_cpufreq" ];
-system.activationScripts.acPlug = ''
- PATH="${pkgs.kmod}/bin:$PATH"
- ${pkgs.acpi}/bin/acpi -a | grep -q 'Adapter .*: on-line' ||
- ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave
-'';
-services.acpid = {
- enable = true;
- handlers = {
- brightnessDown = {
- event = "video/brightnessdown.*";
- action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
- };
- brightnessUp = {
- event = "video/brightnessup.*";
- action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
+ hardware.acpilight.enable = true;
+ services.acpid = {
+ enable = true;
+ handlers = {
+ brightnessDown = {
+ event = "video/brightnessdown.*";
+ action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
+ };
+ brightnessUp = {
+ event = "video/brightnessup.*";
+ action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
+ };
};
};
- acEventCommands = ''
- vals=($1)
- case ''${vals[3]} in
- 00000000) # unplugged
- ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
- 00000001) # plugged in
- ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
- esac
- '';
-};
}