anchor.diff:        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
           '';
       };
     
  
positive.code: {pkgs, config, ...}:
  
  ###### interface
  let
    inherit (pkgs.lib) mkOption mkIf;
  
    options = {
      powerManagement = {
  
        enable = mkOption {
          default = false;
          description = "Whether to enable power management (ACPI daemon)";
        };
      };
    };
  in
  
  ###### implementation
  
  let
  
  
negative.code:       action = 
          ''
            #! ${pkgs.bash}/bin/sh
          '';
      };
  
  in
  
  {
  
    ###### interface
  
    options = {
    
      powerManagement = {
  
        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}";
        };
        
    };
    
  }
  