Merge pull request #153741 from primeos/nixos-tests-tinywl

nixos/tests/tinywl: init

authored by Michael Weiss and committed by GitHub 297cb651 fd7e8516

+62 -1
+1
nixos/tests/all-tests.nix
··· 479 timezone = handleTest ./timezone.nix {}; 480 tinc = handleTest ./tinc {}; 481 tinydns = handleTest ./tinydns.nix {}; 482 tor = handleTest ./tor.nix {}; 483 # traefik test relies on docker-containers 484 traefik = handleTestOn ["x86_64-linux"] ./traefik.nix {};
··· 479 timezone = handleTest ./timezone.nix {}; 480 tinc = handleTest ./tinc {}; 481 tinydns = handleTest ./tinydns.nix {}; 482 + tinywl = handleTest ./tinywl.nix {}; 483 tor = handleTest ./tor.nix {}; 484 # traefik test relies on docker-containers 485 traefik = handleTestOn ["x86_64-linux"] ./traefik.nix {};
+56
nixos/tests/tinywl.nix
···
··· 1 + import ./make-test-python.nix ({ pkgs, lib, ... }: 2 + 3 + { 4 + name = "tinywl"; 5 + meta = { 6 + maintainers = with lib.maintainers; [ primeos ]; 7 + }; 8 + 9 + machine = { config, ... }: { 10 + # Automatically login on tty1 as a normal user: 11 + imports = [ ./common/user-account.nix ]; 12 + services.getty.autologinUser = "alice"; 13 + 14 + environment = { 15 + systemPackages = with pkgs; [ tinywl foot wayland-utils ]; 16 + }; 17 + 18 + # Automatically start TinyWL when logging in on tty1: 19 + programs.bash.loginShellInit = '' 20 + if [ "$(tty)" = "/dev/tty1" ]; then 21 + set -e 22 + test ! -e /tmp/tinywl.log # Only start tinywl once 23 + readonly TEST_CMD="wayland-info |& tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok; read" 24 + readonly FOOT_CMD="foot sh -c '$TEST_CMD'" 25 + tinywl -s "$FOOT_CMD" |& tee /tmp/tinywl.log 26 + touch /tmp/tinywl-exit-ok 27 + fi 28 + ''; 29 + 30 + # Switch to a different GPU driver (default: -vga std), otherwise TinyWL segfaults: 31 + virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; 32 + }; 33 + 34 + testScript = { nodes, ... }: '' 35 + start_all() 36 + machine.wait_for_unit("multi-user.target") 37 + 38 + # Wait for complete startup: 39 + machine.wait_until_succeeds("pgrep tinywl") 40 + machine.wait_for_file("/run/user/1000/wayland-0") 41 + machine.wait_until_succeeds("pgrep foot") 42 + machine.wait_for_file("/tmp/test-wayland-exit-ok") 43 + 44 + # Make a screenshot and save the result: 45 + machine.screenshot("tinywl_foot") 46 + print(machine.succeed("cat /tmp/test-wayland.out")) 47 + machine.copy_from_vm("/tmp/test-wayland.out") 48 + 49 + # Terminate cleanly: 50 + machine.send_key("alt-esc") 51 + machine.wait_until_fails("pgrep foot") 52 + machine.wait_until_fails("pgrep tinywl") 53 + machine.wait_for_file("/tmp/tinywl-exit-ok") 54 + machine.copy_from_vm("/tmp/tinywl.log") 55 + ''; 56 + })
+1 -1
pkgs/applications/window-managers/tinywl/default.nix
··· 21 meta = with lib; { 22 homepage = "https://github.com/swaywm/wlroots/tree/master/tinywl"; 23 description = ''A "minimum viable product" Wayland compositor based on wlroots''; 24 - maintainers = with maintainers; [ qyliss ]; 25 license = licenses.cc0; 26 inherit (wlroots.meta) platforms; 27 };
··· 21 meta = with lib; { 22 homepage = "https://github.com/swaywm/wlroots/tree/master/tinywl"; 23 description = ''A "minimum viable product" Wayland compositor based on wlroots''; 24 + maintainers = with maintainers; [ qyliss ] ++ wlroots.meta.maintainers; 25 license = licenses.cc0; 26 inherit (wlroots.meta) platforms; 27 };
+4
pkgs/development/libraries/wlroots/0.15.nix
··· 2 , libGL, wayland, wayland-protocols, libinput, libxkbcommon, pixman 3 , xcbutilwm, libX11, libcap, xcbutilimage, xcbutilerrors, mesa 4 , libpng, ffmpeg, xcbutilrenderutil, seatd, vulkan-loader, glslang 5 6 , enableXWayland ? true, xwayland ? null 7 }: ··· 48 cp "$binary" "$examples/bin/wlroots-$binary" 49 done 50 ''; 51 52 meta = with lib; { 53 description = "A modular Wayland compositor library";
··· 2 , libGL, wayland, wayland-protocols, libinput, libxkbcommon, pixman 3 , xcbutilwm, libX11, libcap, xcbutilimage, xcbutilerrors, mesa 4 , libpng, ffmpeg, xcbutilrenderutil, seatd, vulkan-loader, glslang 5 + , nixosTests 6 7 , enableXWayland ? true, xwayland ? null 8 }: ··· 49 cp "$binary" "$examples/bin/wlroots-$binary" 50 done 51 ''; 52 + 53 + # Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots): 54 + passthru.tests.tinywl = nixosTests.tinywl; 55 56 meta = with lib; { 57 description = "A modular Wayland compositor library";