llm-ls: cleanup (#372936)
[NixPkgs.git] / nixos / tests / miriway.nix
blob14546dd03dff37f8144a9c8a6d2e217f89b4ee2c
1 import ./make-test-python.nix (
2   { pkgs, lib, ... }:
3   {
4     name = "miriway";
6     meta = {
7       maintainers = with lib.maintainers; [ OPNA2608 ];
8     };
10     nodes.machine =
11       { config, ... }:
12       {
13         imports = [
14           ./common/auto.nix
15           ./common/user-account.nix
16         ];
18         # Seems to very rarely get interrupted by oom-killer
19         virtualisation.memorySize = 2047;
21         test-support.displayManager.auto = {
22           enable = true;
23           user = "alice";
24         };
26         services.xserver.enable = true;
27         services.displayManager.defaultSession = lib.mkForce "miriway";
29         programs.miriway = {
30           enable = true;
31           config = ''
32             add-wayland-extensions=all
33             enable-x11=
35             ctrl-alt=t:foot --maximized
36             ctrl-alt=a:env WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY= alacritty --option window.startup_mode=\"maximized\"
38             shell-component=dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY
40             shell-component=foot --maximized
41           '';
42         };
44         environment = {
45           shellAliases = {
46             test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok";
47             test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok";
48           };
50           systemPackages = with pkgs; [
51             mesa-demos
52             wayland-utils
53             foot
54             alacritty
55           ];
57           # To help with OCR
58           etc."xdg/foot/foot.ini".text = lib.generators.toINI { } {
59             main = {
60               font = "inconsolata:size=16";
61             };
62             colors = rec {
63               foreground = "000000";
64               background = "ffffff";
65               regular2 = foreground;
66             };
67           };
68           etc."xdg/alacritty/alacritty.yml".text = lib.generators.toYAML { } {
69             font = rec {
70               normal.family = "Inconsolata";
71               bold.family = normal.family;
72               italic.family = normal.family;
73               bold_italic.family = normal.family;
74               size = 16;
75             };
76             colors = rec {
77               primary = {
78                 foreground = "0x000000";
79                 background = "0xffffff";
80               };
81               normal = {
82                 green = primary.foreground;
83               };
84             };
85           };
86         };
88         fonts.packages = [ pkgs.inconsolata ];
89       };
91     enableOCR = true;
93     testScript =
94       { nodes, ... }:
95       ''
96         start_all()
97         machine.wait_for_unit("multi-user.target")
99         # Wait for Miriway to complete startup
100         machine.wait_for_file("/run/user/1000/wayland-0")
101         machine.succeed("pgrep miriway-shell")
102         machine.screenshot("miriway_launched")
104         # Test Wayland
105         # We let Miriway start the first terminal, as we might get stuck if it's not ready to process the first keybind
106         # machine.send_key("ctrl-alt-t")
107         machine.wait_for_text(r"(alice|machine)")
108         machine.send_chars("test-wayland\n")
109         machine.wait_for_file("/tmp/test-wayland-exit-ok")
110         machine.copy_from_vm("/tmp/test-wayland.out")
111         machine.screenshot("foot_wayland_info")
112         # Only succeeds when a mouse is moved inside an interactive session?
113         # machine.send_chars("exit\n")
114         # machine.wait_until_fails("pgrep foot")
115         machine.succeed("pkill foot")
117         # Test XWayland
118         machine.send_key("ctrl-alt-a")
119         machine.wait_for_text(r"(alice|machine)")
120         machine.send_chars("test-x11\n")
121         machine.wait_for_file("/tmp/test-x11-exit-ok")
122         machine.copy_from_vm("/tmp/test-x11.out")
123         machine.screenshot("alacritty_glinfo")
124         # Only succeeds when a mouse is moved inside an interactive session?
125         # machine.send_chars("exit\n")
126         # machine.wait_until_fails("pgrep alacritty")
127         machine.succeed("pkill alacritty")
128       '';
129   }