anchor.diff:        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
  +      enable = mkOption {
  +        default = false;
  +        description = "Whether to enable power management (ACPI daemon)";
  +      };
  +      
  +    };
  +    
  +  };
  +  
   
  -        respawn ${pkgs.acpid}/sbin/acpid --foreground --confdir ${acpiConfDir}
  -      '';
  -    }];
  +  ###### 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}";
  +      };
  +      
     };
  +  
   }
  
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
          '';
      };
    
  