* Run the ACPI daemon. This allows the system to respond to ACPI

events, like pressing the power button.  The NVIDIA X11 driver also
  needs it to respond to the internal/external monitor switch button
  on laptops.  The power actions should of course be made
  configurable.

svn path=/nixos/branches/fix-style/; revision=14180
This commit is contained in:
Nicolas Pierron 2009-02-22 16:08:22 +00:00
parent f28c8ca553
commit 128699688a
2 changed files with 48 additions and 0 deletions

42
upstart-jobs/acpid.nix Normal file
View File

@ -0,0 +1,42 @@
{pkgs, config, ...}:
let
acpiConfDir = pkgs.runCommand "acpi-events" {}
''
ensureDir $out
ln -s ${acpiConfFile} $out/events.conf
'';
acpiConfFile = pkgs.writeText "acpi.conf"
''
event=button/power.*
action=${powerEventHandler} "%e"
'';
# Called when the power button is pressed.
powerEventHandler = pkgs.writeScript "acpi-power.sh"
''
#! ${pkgs.bash}/bin/sh
# Suspend to RAM.
#echo mem > /sys/power/state
exit 0
'';
in
{
name = "acpid";
extraPath = [pkgs.acpid];
job = ''
description "ACPI daemon"
start on udev
stop on shutdown
respawn ${pkgs.acpid}/sbin/acpid --foreground --confdir ${acpiConfDir}
'';
}

View File

@ -360,6 +360,12 @@ let
inherit (config.services.bitlbee) portNumber interface;
})
# ACPI daemon.
++ optional true /* !!! need some option */
(import ../upstart-jobs/acpid.nix {
inherit config pkgs;
})
# Postfix mail server.
++ optional config.services.postfix.enable
(import ../upstart-jobs/postfix.nix {