1 import ./make-test-python.nix ({ pkgs, lib, ...} :
4 cagebreakConfigfile = pkgs.writeText "config" ''
7 bind t exec env DISPLAY=:0 ${pkgs.xterm}/bin/xterm -cm -pc
12 meta = with pkgs.lib.maintainers; {
13 maintainers = [ berbiche ];
16 nodes.machine = { config, ... }:
18 # Automatically login on tty1 as a normal user:
19 imports = [ ./common/user-account.nix ];
20 services.getty.autologinUser = "alice";
21 programs.bash.loginShellInit = ''
22 if [ "$(tty)" = "/dev/tty1" ]; then
25 mkdir -p ~/.config/cagebreak
26 cp -f ${cagebreakConfigfile} ~/.config/cagebreak/config
32 hardware.graphics.enable = true;
33 programs.xwayland.enable = true;
34 security.polkit.enable = true;
35 environment.systemPackages = [ pkgs.cagebreak pkgs.wayland-utils ];
37 # Need to switch to a different GPU driver than the default one (-vga std) so that Cagebreak can launch:
38 virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
43 testScript = { nodes, ... }: let
44 user = nodes.machine.config.users.users.alice;
45 XDG_RUNTIME_DIR = "/run/user/${toString user.uid}";
48 machine.wait_for_unit("multi-user.target")
49 machine.wait_for_file("${XDG_RUNTIME_DIR}/wayland-0")
51 with subtest("ensure wayland works with wayinfo from wallutils"):
52 print(machine.succeed("env XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} wayland-info"))
54 # TODO: Fix the XWayland test (log the cagebreak output to debug):
55 # with subtest("ensure xwayland works with xterm"):
56 # machine.send_key("ctrl-t")
57 # machine.send_key("t")
58 # machine.wait_until_succeeds("pgrep xterm")
59 # machine.wait_for_text("${user.name}@machine")
60 # machine.screenshot("screen")
61 # machine.send_key("ctrl-d")