From d142b8a13b955143147077309fdee88375cfea0d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Sep 2009 09:52:25 +0000 Subject: [PATCH] * Remove the ACPI actions. There's obsolete now (handled by HAL / pm-utils / KDE). svn path=/nixos/trunk/; revision=17495 --- modules/services/hardware/acpid.nix | 82 ++++++++++++----------------- 1 file changed, 34 insertions(+), 48 deletions(-) diff --git a/modules/services/hardware/acpid.nix b/modules/services/hardware/acpid.nix index 5ab724b431c4..10449aac2164 100644 --- a/modules/services/hardware/acpid.nix +++ b/modules/services/hardware/acpid.nix @@ -1,21 +1,6 @@ -{pkgs, config, ...}: +{ config, pkgs, ... }: -###### interface -let - inherit (pkgs.lib) mkOption mkIf; - - options = { - powerManagement = { - - enable = mkOption { - default = false; - description = "Whether to enable power management (ACPI daemon)"; - }; - }; - }; -in - -###### implementation +with pkgs.lib; let @@ -35,6 +20,8 @@ let } ''; + events = [powerEvent lidEvent acEvent]; + # Called when the power button is pressed. powerEvent = { name = "power-button"; @@ -52,14 +39,6 @@ let action = '' #! ${pkgs.bash}/bin/sh - - # Suspend to RAM if the lid is closed. (We also get this event - # when the lid just opened, in which case we obviously don't - # want to suspend again.) - if grep -q closed /proc/acpi/button/lid/LID/state; then - sync - echo mem > /sys/power/state - fi ''; }; @@ -70,36 +49,43 @@ let action = '' #! ${pkgs.bash}/bin/sh - - if grep -q "state:.*on-line" /proc/acpi/ac_adapter/AC/state; then - echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor - elif grep -q "state:.*off-line" /proc/acpi/ac_adapter/AC/state; then - echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor - fi ''; }; - events = [powerEvent lidEvent acEvent]; - in -mkIf config.powerManagement.enable { - require = [ - options - ]; +{ - services = { - extraJobs = [{ - name = "acpid"; + ###### interface - job = '' - description "ACPI daemon" + options = { + + powerManagement = { - start on udev - stop on shutdown - - respawn ${pkgs.acpid}/sbin/acpid --foreground --confdir ${acpiConfDir} - ''; - }]; + enable = mkOption { + default = false; + description = "Whether to enable power management (ACPI daemon)"; + }; + + }; + }; + + + ###### implementation + + config = mkIf config.powerManagement.enable { + + jobs = singleton + { name = "acpid"; + description = "ACPI daemon"; + + startOn = "udev"; + stopOn = "shutdown"; + + exec = "${pkgs.acpid}/sbin/acpid --foreground --confdir ${acpiConfDir}"; + }; + + }; + }