at master 4.2 kB view raw
1{ pkgs, lib, ... }: 2{ 3 name = "miriway"; 4 5 meta = { 6 maintainers = with lib.maintainers; [ OPNA2608 ]; 7 }; 8 9 nodes.machine = 10 { config, ... }: 11 { 12 imports = [ 13 ./common/auto.nix 14 ./common/user-account.nix 15 ]; 16 17 # Seems to very rarely get interrupted by oom-killer 18 virtualisation.memorySize = 2047; 19 20 test-support.displayManager.auto = { 21 enable = true; 22 user = "alice"; 23 }; 24 25 programs.ydotool.enable = true; 26 27 services.xserver.enable = true; 28 services.displayManager.defaultSession = lib.mkForce "miriway"; 29 30 programs.miriway = { 31 enable = true; 32 config = '' 33 add-wayland-extensions=all 34 enable-x11= 35 36 ctrl-alt=t:foot --maximized 37 ctrl-alt=a:env WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY= alacritty --option window.startup_mode=\"maximized\" 38 39 shell-component=dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY 40 41 shell-component=foot --maximized 42 ''; 43 }; 44 45 environment = { 46 shellAliases = { 47 test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok"; 48 test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok"; 49 }; 50 51 systemPackages = with pkgs; [ 52 mesa-demos 53 wayland-utils 54 foot 55 alacritty 56 ]; 57 58 # To help with OCR 59 etc."xdg/foot/foot.ini".source = (pkgs.formats.ini { }).generate "foot.ini" { 60 main = { 61 font = "inconsolata:size=16"; 62 }; 63 colors = rec { 64 foreground = "000000"; 65 background = "ffffff"; 66 regular2 = foreground; 67 }; 68 }; 69 etc."xdg/alacritty/alacritty.toml".source = (pkgs.formats.toml { }).generate "alacritty.toml" { 70 font = rec { 71 normal.family = "Inconsolata"; 72 bold.family = normal.family; 73 italic.family = normal.family; 74 bold_italic.family = normal.family; 75 size = 16; 76 }; 77 colors = rec { 78 primary = { 79 foreground = "0x000000"; 80 background = "0xffffff"; 81 }; 82 normal = { 83 green = primary.foreground; 84 }; 85 }; 86 }; 87 }; 88 89 fonts.packages = [ pkgs.inconsolata ]; 90 }; 91 92 enableOCR = true; 93 94 testScript = 95 { nodes, ... }: 96 '' 97 start_all() 98 machine.wait_for_unit("multi-user.target") 99 100 # Wait for Miriway to complete startup 101 machine.wait_for_file("/run/user/1000/wayland-0") 102 machine.succeed("pgrep miriway-shell") 103 machine.screenshot("miriway_launched") 104 105 # Test Wayland 106 # We let Miriway start the first terminal, as we might get stuck if it's not ready to process the first keybind 107 # machine.send_key("ctrl-alt-t") 108 machine.wait_for_text(r"(alice|machine)") 109 machine.send_chars("test-wayland\n") 110 machine.wait_for_file("/tmp/test-wayland-exit-ok") 111 machine.copy_from_vm("/tmp/test-wayland.out") 112 machine.screenshot("foot_wayland_info") 113 114 # please actually register that we want to close the window 115 machine.succeed("ydotool mousemove -- 10 10") 116 machine.sleep(3) 117 118 machine.send_chars("exit\n") 119 120 # please actually register that we want to close the window 121 machine.succeed("ydotool mousemove -- 10 10") 122 machine.sleep(3) 123 124 machine.wait_until_fails("pgrep foot") 125 126 # Test XWayland 127 machine.send_key("ctrl-alt-a") 128 machine.wait_for_text(r"(alice|machine)") 129 machine.send_chars("test-x11\n") 130 machine.wait_for_file("/tmp/test-x11-exit-ok") 131 machine.copy_from_vm("/tmp/test-x11.out") 132 machine.screenshot("alacritty_glinfo") 133 134 # please actually register that we want to close the window 135 machine.succeed("ydotool mousemove -- 10 10") 136 machine.sleep(3) 137 138 machine.send_chars("exit\n") 139 140 # please actually register that we want to close the window 141 machine.succeed("ydotool mousemove -- 10 10") 142 machine.sleep(3) 143 144 machine.wait_until_fails("pgrep alacritty") 145 ''; 146}