Power Management

From NixOS Wiki
Revision as of 19:30, 14 October 2017 by imported>Samueldr (Created page with "{{expansion}} == Suspend == === Suspend hooks === NixOS provides the {{nixos:option|powerManagement.resumeCommands}} option which defines commands that are added to a globa...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Suspend

Suspend hooks

NixOS provides the powerManagement.resumeCommands option which defines commands that are added to a global script that will be executed after resuming.

powerManagement.resumeCommands = ''
  echo "This should show up in the journal after resuming."
'';

It is also possible, to use the post-resume target directly to make a service. Refer to the Systemd Services article for details about writing systemd services for NixOS.

  systemd.services.your-service-name = { 
    description = "Service description here";
    wantedBy = [ "post-resume.target" ];
    after = [ "post-resume.target" ];
    script = ''
    echo "This should show up in the journal after resuming."
    '';
    serviceConfig.Type = "oneshot";
  };


External resources