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 # Automatically start TinyWL when logging in on tty1:
20 programs.bash.loginShellInit = ''
21 if [ "$(tty)" = "/dev/tty1" ]; then
23 test ! -e /tmp/tinywl.log # Only start tinywl once
24 readonly TEST_CMD="wayland-info |& tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok; read"
25 readonly FOOT_CMD="foot sh -c '$TEST_CMD'"
26 tinywl -s "$FOOT_CMD" |& tee /tmp/tinywl.log
27 touch /tmp/tinywl-exit-ok
31 # Switch to a different GPU driver (default: -vga std), otherwise TinyWL segfaults:
32 virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
35 testScript = { nodes, ... }: ''
37 machine.wait_for_unit("multi-user.target")
39 # Wait for complete startup:
40 machine.wait_until_succeeds("pgrep tinywl")
41 machine.wait_for_file("/run/user/1000/wayland-0")
42 machine.wait_until_succeeds("pgrep foot")
43 machine.wait_for_file("/tmp/test-wayland-exit-ok")
45 # Make a screenshot and save the result:
46 machine.screenshot("tinywl_foot")
47 print(machine.succeed("cat /tmp/test-wayland.out"))
48 machine.copy_from_vm("/tmp/test-wayland.out")
51 machine.send_key("alt-esc")
52 machine.wait_until_fails("pgrep foot")
53 machine.wait_until_fails("pgrep tinywl")
54 machine.wait_for_file("/tmp/tinywl-exit-ok")
55 machine.copy_from_vm("/tmp/tinywl.log")