at master 4.0 kB view raw
1{ pkgs, lib, ... }: 2{ 3 name = "cinnamon-wayland"; 4 5 meta.maintainers = lib.teams.cinnamon.members; 6 7 nodes.machine = 8 { nodes, ... }: 9 { 10 imports = [ ./common/user-account.nix ]; 11 services.xserver.enable = true; 12 services.xserver.desktopManager.cinnamon.enable = true; 13 services.displayManager = { 14 autoLogin.enable = true; 15 autoLogin.user = nodes.machine.users.users.alice.name; 16 defaultSession = "cinnamon-wayland"; 17 }; 18 19 # For the sessionPath subtest. 20 services.xserver.desktopManager.cinnamon.sessionPath = [ pkgs.gpaste ]; 21 }; 22 23 enableOCR = true; 24 25 testScript = 26 { nodes, ... }: 27 let 28 user = nodes.machine.users.users.alice; 29 env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus"; 30 su = command: "su - ${user.name} -c '${env} ${command}'"; 31 32 # Call javascript in cinnamon (the shell), returns a tuple (success, output), 33 # where `success` is true if the dbus call was successful and `output` is what 34 # the javascript evaluates to. 35 eval = 36 name: su "gdbus call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval ${name}"; 37 in 38 '' 39 machine.wait_for_unit("display-manager.service") 40 41 with subtest("Wait for wayland server"): 42 machine.wait_for_file("/run/user/${toString user.uid}/wayland-0") 43 44 with subtest("Check that logging in has given the user ownership of devices"): 45 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") 46 47 with subtest("Wait for the Cinnamon shell"): 48 # Correct output should be (true, '2') 49 # https://github.com/linuxmint/cinnamon/blob/5.4.0/js/ui/main.js#L183-L187 50 machine.wait_until_succeeds("${eval "Main.runState"} | grep -q 'true,..2'") 51 52 with subtest("Check if Cinnamon components actually start"): 53 for i in ["csd-media-keys", "xapp-sn-watcher", "nemo-desktop"]: 54 machine.wait_until_succeeds(f"pgrep -f {i}") 55 machine.wait_until_succeeds("journalctl -b --grep 'Loaded applet menu@cinnamon.org'") 56 machine.wait_until_succeeds("journalctl -b --grep 'calendar@cinnamon.org: Calendar events supported'") 57 58 with subtest("Check if sessionPath option actually works"): 59 machine.succeed("${eval "imports.gi.GIRepository.Repository.get_search_path\\(\\)"} | grep gpaste") 60 61 with subtest("Check if various environment variables are set"): 62 cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf /run/current-system/sw/bin/nemo-desktop)/environ" 63 machine.succeed(f"{cmd} | grep 'XDG_SESSION_TYPE' | grep 'wayland'") 64 machine.succeed(f"{cmd} | grep '__NIXOS_SET_ENVIRONMENT_DONE' | grep '1'") 65 # From the nixos/cinnamon module 66 machine.succeed(f"{cmd} | grep 'SSH_AUTH_SOCK' | grep 'gcr'") 67 68 with subtest("Open Cinnamon Settings"): 69 machine.succeed("${su "cinnamon-settings themes >&2 &"}") 70 machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'cinnamon-settings'") 71 machine.wait_for_text('(Style|Appearance|Color)') 72 machine.sleep(2) 73 machine.screenshot("cinnamon_settings") 74 75 with subtest("Check if screensaver works"): 76 # This is not supported at the moment. 77 # https://trello.com/b/HHs01Pab/cinnamon-wayland 78 machine.execute("${su "cinnamon-screensaver-command -l >&2 &"}") 79 machine.wait_until_succeeds("journalctl -b --grep 'cinnamon-screensaver is disabled in wayland sessions'") 80 81 with subtest("Open GNOME Terminal"): 82 machine.succeed("${su "dbus-launch gnome-terminal"}") 83 machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'gnome-terminal'") 84 machine.sleep(2) 85 86 with subtest("Check if Cinnamon has ever coredumped"): 87 machine.fail("coredumpctl --json=short | grep -E 'cinnamon|nemo'") 88 ''; 89}