at 25.11-pre 2.2 kB view raw
1import ./make-test-python.nix ( 2 { pkgs, lib, ... }: 3 4 let 5 cagebreakConfigfile = pkgs.writeText "config" '' 6 workspaces 1 7 escape C-t 8 bind t exec env DISPLAY=:0 ${pkgs.xterm}/bin/xterm -cm -pc 9 ''; 10 in 11 { 12 name = "cagebreak"; 13 meta = with pkgs.lib.maintainers; { 14 maintainers = [ berbiche ]; 15 }; 16 17 nodes.machine = 18 { config, ... }: 19 { 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.graphics.enable = true; 35 programs.xwayland.enable = true; 36 security.polkit.enable = true; 37 environment.systemPackages = [ 38 pkgs.cagebreak 39 pkgs.wayland-utils 40 ]; 41 42 # Need to switch to a different GPU driver than the default one (-vga std) so that Cagebreak can launch: 43 virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; 44 }; 45 46 enableOCR = true; 47 48 testScript = 49 { nodes, ... }: 50 let 51 user = nodes.machine.config.users.users.alice; 52 XDG_RUNTIME_DIR = "/run/user/${toString user.uid}"; 53 in 54 '' 55 start_all() 56 machine.wait_for_unit("multi-user.target") 57 machine.wait_for_file("${XDG_RUNTIME_DIR}/wayland-0") 58 59 with subtest("ensure wayland works with wayinfo from wallutils"): 60 print(machine.succeed("env XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} wayland-info")) 61 62 # TODO: Fix the XWayland test (log the cagebreak output to debug): 63 # with subtest("ensure xwayland works with xterm"): 64 # machine.send_key("ctrl-t") 65 # machine.send_key("t") 66 # machine.wait_until_succeeds("pgrep xterm") 67 # machine.wait_for_text("${user.name}@machine") 68 # machine.screenshot("screen") 69 # machine.send_key("ctrl-d") 70 ''; 71 } 72)