diff options
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/tinywl.nix | 56 | ||||
-rw-r--r-- | pkgs/applications/window-managers/tinywl/default.nix | 2 | ||||
-rw-r--r-- | pkgs/development/libraries/wlroots/0.15.nix | 4 |
4 files changed, 62 insertions, 1 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 4f62980e8e9..dc28b3d6478 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -476,6 +476,7 @@ in timezone = handleTest ./timezone.nix {}; tinc = handleTest ./tinc {}; tinydns = handleTest ./tinydns.nix {}; + tinywl = handleTest ./tinywl.nix {}; tor = handleTest ./tor.nix {}; # traefik test relies on docker-containers traefik = handleTestOn ["x86_64-linux"] ./traefik.nix {}; diff --git a/nixos/tests/tinywl.nix b/nixos/tests/tinywl.nix new file mode 100644 index 00000000000..b286cab7794 --- /dev/null +++ b/nixos/tests/tinywl.nix @@ -0,0 +1,56 @@ +import ./make-test-python.nix ({ pkgs, lib, ... }: + + { + name = "tinywl"; + meta = { + maintainers = with lib.maintainers; [ primeos ]; + }; + + machine = { config, ... }: { + # Automatically login on tty1 as a normal user: + imports = [ ./common/user-account.nix ]; + services.getty.autologinUser = "alice"; + + environment = { + systemPackages = with pkgs; [ tinywl foot wayland-utils ]; + }; + + # Automatically start TinyWL when logging in on tty1: + programs.bash.loginShellInit = '' + if [ "$(tty)" = "/dev/tty1" ]; then + set -e + test ! -e /tmp/tinywl.log # Only start tinywl once + readonly TEST_CMD="wayland-info |& tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok; read" + readonly FOOT_CMD="foot sh -c '$TEST_CMD'" + tinywl -s "$FOOT_CMD" |& tee /tmp/tinywl.log + touch /tmp/tinywl-exit-ok + fi + ''; + + # Switch to a different GPU driver (default: -vga std), otherwise TinyWL segfaults: + virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; + }; + + testScript = { nodes, ... }: '' + start_all() + machine.wait_for_unit("multi-user.target") + + # Wait for complete startup: + machine.wait_until_succeeds("pgrep tinywl") + machine.wait_for_file("/run/user/1000/wayland-0") + machine.wait_until_succeeds("pgrep foot") + machine.wait_for_file("/tmp/test-wayland-exit-ok") + + # Make a screenshot and save the result: + machine.screenshot("tinywl_foot") + print(machine.succeed("cat /tmp/test-wayland.out")) + machine.copy_from_vm("/tmp/test-wayland.out") + + # Terminate cleanly: + machine.send_key("alt-esc") + machine.wait_until_fails("pgrep foot") + machine.wait_until_fails("pgrep tinywl") + machine.wait_for_file("/tmp/tinywl-exit-ok") + machine.copy_from_vm("/tmp/tinywl.log") + ''; + }) diff --git a/pkgs/applications/window-managers/tinywl/default.nix b/pkgs/applications/window-managers/tinywl/default.nix index 965ec67b6e9..b89d9dafd90 100644 --- a/pkgs/applications/window-managers/tinywl/default.nix +++ b/pkgs/applications/window-managers/tinywl/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation { meta = with lib; { homepage = "https://github.com/swaywm/wlroots/tree/master/tinywl"; description = ''A "minimum viable product" Wayland compositor based on wlroots''; - maintainers = with maintainers; [ qyliss ]; + maintainers = with maintainers; [ qyliss ] ++ wlroots.meta.maintainers; license = licenses.cc0; inherit (wlroots.meta) platforms; }; diff --git a/pkgs/development/libraries/wlroots/0.15.nix b/pkgs/development/libraries/wlroots/0.15.nix index 93ecf0bd3ab..e7cf7bc9b4c 100644 --- a/pkgs/development/libraries/wlroots/0.15.nix +++ b/pkgs/development/libraries/wlroots/0.15.nix @@ -2,6 +2,7 @@ , libGL, wayland, wayland-protocols, libinput, libxkbcommon, pixman , xcbutilwm, libX11, libcap, xcbutilimage, xcbutilerrors, mesa , libpng, ffmpeg, xcbutilrenderutil, seatd, vulkan-loader, glslang +, nixosTests , enableXWayland ? true, xwayland ? null }: @@ -49,6 +50,9 @@ stdenv.mkDerivation rec { done ''; + # Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots): + passthru.tests.tinywl = nixosTests.tinywl; + meta = with lib; { description = "A modular Wayland compositor library"; longDescription = '' |