1{ pkgs, lib, ... }:
2{
3 name = "mate-wayland";
4
5 meta.maintainers = lib.teams.mate.members;
6
7 nodes.machine =
8 { ... }:
9 {
10 imports = [
11 ./common/user-account.nix
12 ];
13
14 services.xserver.enable = true;
15 services.displayManager = {
16 sddm.enable = true; # https://github.com/canonical/lightdm/issues/63
17 sddm.wayland.enable = true;
18 defaultSession = "MATE";
19 autoLogin = {
20 enable = true;
21 user = "alice";
22 };
23 };
24 services.xserver.desktopManager.mate.enableWaylandSession = true;
25
26 # Need to switch to a different GPU driver than the default one (-vga std) so that wayfire can launch:
27 virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
28 };
29
30 enableOCR = true;
31
32 testScript =
33 { nodes, ... }:
34 let
35 user = nodes.machine.users.users.alice;
36 in
37 ''
38 machine.wait_for_unit("display-manager.service")
39
40 with subtest("Wait for Wayland server"):
41 machine.wait_for_file("/run/user/${toString user.uid}/wayland-1")
42
43 with subtest("Check if MATE session components actually start"):
44 for i in ["wayfire", "mate-panel", "mate-wayland.sh"]:
45 machine.wait_until_succeeds(f"pgrep {i}")
46 machine.wait_until_succeeds("pgrep -f mate-wayland-components.sh")
47 # It is expected that WorkspaceSwitcherApplet doesn't work in Wayland
48 machine.wait_for_text('(panel|Factory|Workspace|Switcher|Applet|configuration)')
49
50 with subtest("Check if various environment variables are set"):
51 cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf mate-panel)/environ"
52 machine.succeed(f"{cmd} | grep 'XDG_SESSION_TYPE' | grep 'wayland'")
53 machine.succeed(f"{cmd} | grep 'XDG_SESSION_DESKTOP' | grep 'MATE'")
54 machine.succeed(f"{cmd} | grep 'MATE_PANEL_APPLETS_DIR' | grep '${pkgs.mate.mate-panel-with-applets.pname}'")
55 # From the nixos/mate module
56 machine.succeed(f"{cmd} | grep 'SSH_AUTH_SOCK' | grep 'gcr'")
57
58 with subtest("Check if Wayfire config is properly configured"):
59 for i in ["autostart_wf_shell = false", "mate-wayland-components.sh"]:
60 machine.wait_until_succeeds(f"cat /home/${user.name}/.config/mate/wayfire.ini | grep '{i}'")
61
62 with subtest("Check if Wayfire has ever coredumped"):
63 machine.fail("coredumpctl --json=short | grep wayfire")
64 machine.sleep(10)
65 machine.screenshot("screen")
66 '';
67}