git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #153741 from primeos/nixos-tests-tinywl

nixos/tests/tinywl: init

commit297cb6514fbc8a547438319d2eaa4ce6b98c856a authorMichael Weiss <dev.primeos@gmail.com> dateFri 14 Jan 2022, 23:45 (5 years ago) parentfd7e851e9efbc0
4 files changed+62−1
nixos/tests/all-tests.nix+1 nixos/tests/tinywl.nix+56 pkgs/applications/window-managers/tinywl/default.nix+1−1 pkgs/development/libraries/wlroots/0.15.nix+4
nixos/tests/all-tests.nix+1
@@ -479,6 +479,7 @@ in
479479 timezone = handleTest ./timezone.nix {};
480480 tinc = handleTest ./tinc {};
481481 tinydns = handleTest ./tinydns.nix {};
482+ tinywl = handleTest ./tinywl.nix {};
482483 tor = handleTest ./tor.nix {};
483484 # traefik test relies on docker-containers
484485 traefik = handleTestOn ["x86_64-linux"] ./traefik.nix {};
nixos/tests/tinywl.nixnew file+56
@@ -0,0 +1,56 @@
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+ })
pkgs/applications/window-managers/tinywl/default.nix+1−1
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
2121 meta = with lib; {
2222 homepage = "https://github.com/swaywm/wlroots/tree/master/tinywl";
2323 description = ''A "minimum viable product" Wayland compositor based on wlroots'';
24− maintainers = with maintainers; [ qyliss ];
24+ maintainers = with maintainers; [ qyliss ] ++ wlroots.meta.maintainers;
2525 license = licenses.cc0;
2626 inherit (wlroots.meta) platforms;
2727 };
pkgs/development/libraries/wlroots/0.15.nix+4
@@ -2,6 +2,7 @@
22, libGL, wayland, wayland-protocols, libinput, libxkbcommon, pixman
33, xcbutilwm, libX11, libcap, xcbutilimage, xcbutilerrors, mesa
44, libpng, ffmpeg, xcbutilrenderutil, seatd, vulkan-loader, glslang
5+, nixosTests
56
67, enableXWayland ? true, xwayland ? null
78}:
@@ -49,6 +50,9 @@ stdenv.mkDerivation rec {
4950 done
5051 '';
5152
53+ # Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots):
54+ passthru.tests.tinywl = nixosTests.tinywl;
55+
5256 meta = with lib; {
5357 description = "A modular Wayland compositor library";
5458 longDescription = ''