at 23.11-pre 2.0 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ...} : 2 3let 4 cagebreakConfigfile = pkgs.writeText "config" '' 5 workspaces 1 6 escape C-t 7 bind t exec env DISPLAY=:0 ${pkgs.xterm}/bin/xterm -cm -pc 8 ''; 9in 10{ 11 name = "cagebreak"; 12 meta = with pkgs.lib.maintainers; { 13 maintainers = [ berbiche ]; 14 }; 15 16 nodes.machine = { config, ... }: 17 let 18 alice = config.users.users.alice; 19 in { 20 # Automatically login on tty1 as a normal user: 21 imports = [ ./common/user-account.nix ]; 22 services.getty.autologinUser = "alice"; 23 programs.bash.loginShellInit = '' 24 if [ "$(tty)" = "/dev/tty1" ]; then 25 set -e 26 27 mkdir -p ~/.config/cagebreak 28 cp -f ${cagebreakConfigfile} ~/.config/cagebreak/config 29 30 cagebreak 31 fi 32 ''; 33 34 hardware.opengl.enable = true; 35 programs.xwayland.enable = true; 36 security.polkit.enable = true; 37 environment.systemPackages = [ pkgs.cagebreak pkgs.wayland-utils ]; 38 39 # Need to switch to a different GPU driver than the default one (-vga std) so that Cagebreak can launch: 40 virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; 41 }; 42 43 enableOCR = true; 44 45 testScript = { nodes, ... }: let 46 user = nodes.machine.config.users.users.alice; 47 XDG_RUNTIME_DIR = "/run/user/${toString user.uid}"; 48 in '' 49 start_all() 50 machine.wait_for_unit("multi-user.target") 51 machine.wait_for_file("${XDG_RUNTIME_DIR}/wayland-0") 52 53 with subtest("ensure wayland works with wayinfo from wallutils"): 54 print(machine.succeed("env XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} wayland-info")) 55 56 # TODO: Fix the XWayland test (log the cagebreak output to debug): 57 # with subtest("ensure xwayland works with xterm"): 58 # machine.send_key("ctrl-t") 59 # machine.send_key("t") 60 # machine.wait_until_succeeds("pgrep xterm") 61 # machine.wait_for_text("${user.name}@machine") 62 # machine.screenshot("screen") 63 # machine.send_key("ctrl-d") 64 ''; 65})