]> Git — Sourcephile - julm/julm-nix.git/blob - nixos/profiles/acpid.nix
nix: revamp settings in nixos/profiles
[julm/julm-nix.git] / nixos / profiles / acpid.nix
1 { config, lib, pkgs, ... }:
2 {
3 hardware.acpilight.enable = true;
4 services.acpid = {
5 enable = true;
6 handlers = {
7 brightnessDown = {
8 event = "video/brightnessdown.*";
9 action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
10 };
11 brightnessUp = {
12 event = "video/brightnessup.*";
13 action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
14 };
15 };
16 acEventCommands = ''
17 vals=($1)
18 case ''${vals[3]} in
19 00000000) # unplugged
20 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
21 00000001) # plugged in
22 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
23 esac
24 '';
25 };
26 }