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