summary refs log tree commit diff
path: root/modules/config
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-12-02 20:23:45 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-12-02 20:23:45 +0000
commitd5fb41795f93127e6d20dac7ee532400e2d5a64d (patch)
treea7c7c831cba57df32881faf117605904787540dd /modules/config
parent651a38019ddd3aae4a80384ef2c527dcd85c0c74 (diff)
downloadnixpkgs-d5fb41795f93127e6d20dac7ee532400e2d5a64d.tar
nixpkgs-d5fb41795f93127e6d20dac7ee532400e2d5a64d.tar.gz
nixpkgs-d5fb41795f93127e6d20dac7ee532400e2d5a64d.tar.bz2
nixpkgs-d5fb41795f93127e6d20dac7ee532400e2d5a64d.tar.lz
nixpkgs-d5fb41795f93127e6d20dac7ee532400e2d5a64d.tar.xz
nixpkgs-d5fb41795f93127e6d20dac7ee532400e2d5a64d.tar.zst
nixpkgs-d5fb41795f93127e6d20dac7ee532400e2d5a64d.zip
Adding a wake on lan module.
svn path=/nixos/trunk/; revision=24958
Diffstat (limited to 'modules/config')
-rw-r--r--modules/config/power-management.nix22
1 files changed, 19 insertions, 3 deletions
diff --git a/modules/config/power-management.nix b/modules/config/power-management.nix
index ce67285140e..6baefa12791 100644
--- a/modules/config/power-management.nix
+++ b/modules/config/power-management.nix
@@ -10,9 +10,14 @@ let
     ''
       #! ${pkgs.stdenv.shell}
       action="$1"
-      if [ "$action" = "resume" ]; then
-          ${cfg.resumeCommands}
-          ${cfg.powerUpCommands}
+      case "$action" in
+          hibernate|suspend)
+              ${cfg.powerDownCommands}
+              ;;
+          thaw|resume)
+              ${cfg.resumeCommands}
+              ${cfg.powerUpCommands}
+              ;;
       fi
     '';
 
@@ -50,6 +55,17 @@ in
             it resumes from suspend or hibernation.
           '';
       };
+
+      powerDownCommands = mkOption {
+        default = "";
+        example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda";
+        description =
+          ''
+            Commands executed when the machine powers down.  That is,
+            they're executed both when the system shuts down and when
+            it goes to suspend or hibernation.
+          '';
+      };
       
     };