1 import ./make-test-python.nix ({ pkgs, lib, ... }:
6 maintainers = with lib.maintainers; [ primeos ];
9 nodes.machine = { config, ... }: {
10 # Automatically login on tty1 as a normal user:
11 imports = [ ./common/user-account.nix ];
12 services.getty.autologinUser = "alice";
13 security.polkit.enable = true;
16 systemPackages = with pkgs; [ tinywl foot wayland-utils ];
19 hardware.graphics.enable = true;
21 # Automatically start TinyWL when logging in on tty1:
22 programs.bash.loginShellInit = ''
23 if [ "$(tty)" = "/dev/tty1" ]; then
25 test ! -e /tmp/tinywl.log # Only start tinywl once
26 readonly TEST_CMD="wayland-info |& tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok; read"
27 readonly FOOT_CMD="foot sh -c '$TEST_CMD'"
28 tinywl -s "$FOOT_CMD" |& tee /tmp/tinywl.log
29 touch /tmp/tinywl-exit-ok
33 # Switch to a different GPU driver (default: -vga std), otherwise TinyWL segfaults:
34 virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
37 testScript = { nodes, ... }: ''
39 machine.wait_for_unit("multi-user.target")
41 # Wait for complete startup:
42 machine.wait_until_succeeds("pgrep tinywl")
43 machine.wait_for_file("/run/user/1000/wayland-0")
44 machine.wait_until_succeeds("pgrep foot")
45 machine.wait_for_file("/tmp/test-wayland-exit-ok")
47 # Make a screenshot and save the result:
48 machine.screenshot("tinywl_foot")
49 print(machine.succeed("cat /tmp/test-wayland.out"))
50 machine.copy_from_vm("/tmp/test-wayland.out")
53 machine.send_key("alt-esc")
54 machine.wait_until_fails("pgrep foot")
55 machine.wait_until_fails("pgrep tinywl")
56 machine.wait_for_file("/tmp/tinywl-exit-ok")
57 machine.copy_from_vm("/tmp/tinywl.log")