1import ./make-test-python.nix ({ pkgs, lib, ... }:
2
3with lib;
4
5{
6 name = "xss-lock";
7 meta.maintainers = with pkgs.lib.maintainers; [ ];
8
9 nodes = {
10 simple = {
11 imports = [ ./common/x11.nix ./common/user-account.nix ];
12 programs.xss-lock.enable = true;
13 test-support.displayManager.auto.user = "alice";
14 };
15
16 custom_lockcmd = { pkgs, ... }: {
17 imports = [ ./common/x11.nix ./common/user-account.nix ];
18 test-support.displayManager.auto.user = "alice";
19
20 programs.xss-lock = {
21 enable = true;
22 extraOptions = [ "-n" "${pkgs.libnotify}/bin/notify-send 'About to sleep!'"];
23 lockerCommand = "${pkgs.xlockmore}/bin/xlock -mode ant";
24 };
25 };
26 };
27
28 testScript = ''
29 def perform_xsslock_test(machine, lockCmd):
30 machine.start()
31 machine.wait_for_x()
32 machine.wait_for_unit("xss-lock.service", "alice")
33 machine.fail(f"pgrep {lockCmd}")
34 machine.succeed("su -l alice -c 'xset dpms force standby'")
35 machine.wait_until_succeeds(f"pgrep {lockCmd}")
36
37
38 with subtest("simple"):
39 perform_xsslock_test(simple, "i3lock")
40
41 with subtest("custom_cmd"):
42 perform_xsslock_test(custom_lockcmd, "xlock")
43 '';
44})