···
-
acpiConfDir = pkgs.runCommand "acpi-events" {}
-
# Generate a configuration file for each event. (You can't have
-
# multiple events in one config file...)
-
echo "event=${event.event}" > $fn
-
echo "action=${pkgs.writeScript "${event.name}.sh" event.action}" >> $fn
-
in lib.concatMapStrings f events
-
events = [powerEvent lidEvent acEvent muteEvent volumeDownEvent volumeUpEvent cdPlayEvent cdNextEvent cdPrevEvent];
-
# Called when the power button is pressed.
-
{ name = "power-button";
event = "button/power.*";
-
${config.services.acpid.powerEventCommands}
-
# Called when the laptop lid is opened/closed.
-
${config.services.acpid.lidEventCommands}
-
# Called when the AC power is connected or disconnected.
-
${config.services.acpid.acEventCommands}
-
event = "button/mute.*";
-
${config.services.acpid.muteCommands}
-
event = "button/volumedown.*";
-
${config.services.acpid.volumeDownEventCommands}
-
event = "button/volumeup.*";
-
${config.services.acpid.volumeUpEventCommands}
-
${config.services.acpid.cdPlayEventCommands}
-
${config.services.acpid.cdNextEventCommands}
-
${config.services.acpid.cdPrevEventCommands}
···
description = "Whether to enable the ACPI daemon.";
powerEventCommands = mkOption {
···
description = "Shell commands to execute on an ac_adapter.* event.";
-
muteCommands = mkOption {
-
description = "Shell commands to execute on an button/mute.* event.";
-
volumeDownEventCommands = mkOption {
-
description = "Shell commands to execute on an button/volumedown.* event.";
-
volumeUpEventCommands = mkOption {
-
description = "Shell commands to execute on an button/volumeup.* event.";
-
cdPlayEventCommands = mkOption {
-
description = "Shell commands to execute on an cd/play.* event.";
-
cdNextEventCommands = mkOption {
-
description = "Shell commands to execute on an cd/next.* event.";
-
cdPrevEventCommands = mkOption {
-
description = "Shell commands to execute on an cd/prev.* event.";