1{ pkgs, ... }:
2
3{
4 name = "atd";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ bjornfor ];
7 };
8
9 nodes.machine =
10 { ... }:
11 {
12 services.atd.enable = true;
13 users.users.alice = {
14 isNormalUser = true;
15 };
16 };
17
18 # "at" has a resolution of 1 minute
19 testScript = ''
20 start_all()
21
22 machine.wait_for_unit("atd.service") # wait for atd to start
23 machine.fail("test -f ~root/at-1")
24 machine.fail("test -f ~alice/at-1")
25
26 machine.succeed("echo 'touch ~root/at-1' | at now+1min")
27 machine.succeed("su - alice -c \"echo 'touch at-1' | at now+1min\"")
28
29 machine.succeed("sleep 1.5m")
30
31 machine.succeed("test -f ~root/at-1")
32 machine.succeed("test -f ~alice/at-1")
33 '';
34}