5 node = { pkgs, ... }: {
6 imports = [ ./common/user-account.nix ./common/x11.nix ];
7 services.xserver.enable = true;
8 services.xserver.displayManager.sessionCommands = ''
9 ${pkgs.drawterm}/bin/drawterm -g 1024x768 &
11 test-support.displayManager.auto.user = "alice";
13 systems = [ "x86_64-linux" "aarch64-linux" ];
16 node = { pkgs, ... }: {
17 imports = [ ./common/wayland-cage.nix ];
18 services.cage.program = "${pkgs.drawterm-wayland}/bin/drawterm";
20 systems = [ "x86_64-linux" ];
24 mkTest = name: machine:
25 import ./make-test-python.nix ({ pkgs, ... }: {
28 nodes = { "${name}" = machine; };
30 meta = with pkgs.lib.maintainers; {
31 maintainers = [ moody ];
38 def drawterm_running():
39 machine.succeed("pgrep drawterm")
41 # cage is a bit wonky here.
42 # it seems to lag behind drawing
43 # and somehow needs a single input character
44 # in order to get the first prompt to show up.
45 # This is not present in any other compositor
46 # as far as I know, and after spending a couple
47 # hours with the upstream source trying to deduce
48 # how to perhaps fix it, I figured just polling is OK.
51 machine.send_chars(".")
52 machine.wait_for_text("cpu", 1)
56 machine.wait_for_unit("graphical.target")
57 drawterm_running.wait() # type: ignore[union-attr]
58 cpu_shown_up.wait() # type: ignore[union-attr]
59 machine.send_chars("cpu\n")
60 machine.wait_for_text("auth")
61 machine.send_chars("cpu\n")
62 machine.wait_for_text("ending")
63 machine.screenshot("out.png")
67 mkTestOn = systems: name: machine:
68 if pkgs.lib.elem system systems then mkTest name machine
71 builtins.mapAttrs (k: v: mkTestOn v.systems k v.node { inherit system; }) tests