mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
31 lines
597 B
Nix
31 lines
597 B
Nix
{ lib, pkgs, ... }:
|
|
|
|
{
|
|
name = "autosuspend";
|
|
meta.maintainers = [ lib.maintainers.anthonyroussel ];
|
|
|
|
nodes = {
|
|
machine = {
|
|
services.autosuspend = {
|
|
enable = true;
|
|
|
|
settings = {
|
|
interval = 5;
|
|
idle_time = 5;
|
|
suspend_cmd = "${pkgs.coreutils}/bin/touch /tmp/suspended";
|
|
};
|
|
|
|
# Return exit code 1 to trigger suspend
|
|
checks.ExternalCommand.command = "exit 1";
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
machine.wait_for_unit("autosuspend.service")
|
|
machine.wait_for_file("/tmp/suspended")
|
|
'';
|
|
}
|