blob: ef78e3215dc83632038248cab421d2d5cfeb5f02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
{ 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")
'';
}
|