Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Migrate NixOS integration tests from VMs to containers (#1869)

r33drichardsb1b950fd8309
diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml
index b780c841ee..abf1d9264a 100644
--- a/.github/workflows/nix-build.yml
+++ b/.github/workflows/nix-build.yml
@@ -243,6 +243,13 @@ jobs:
with:
extra_nix_config: |
experimental-features = nix-command flakes
+ # Container-based NixOS integration tests (testers.nixosTest with
+ # `containers`) run under systemd-nspawn instead of QEMU: no KVM
+ # needed, much faster/cheaper. The nspawn builds require an allocated
+ # UID range and cgroup delegation, advertised here on the builder.
+ extra-experimental-features = auto-allocate-uids cgroups
+ auto-allocate-uids = true
+ extra-system-features = uid-range
substituters = s3://${{ env.NIX_CACHE_BUCKET }}?region=${{ env.AWS_REGION }} https://cache.nixos.org
trusted-substituters = s3://${{ env.NIX_CACHE_BUCKET }}?region=${{ env.AWS_REGION }}
trusted-public-keys = ${{ steps.nix-key.outputs.public_key }} cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
diff --git a/.github/workflows/nix-screenshot.yml b/.github/workflows/nix-screenshot.yml
index 8b97ae9ecc..7d9f8b9a59 100644
--- a/.github/workflows/nix-screenshot.yml
+++ b/.github/workflows/nix-screenshot.yml
@@ -63,6 +63,13 @@ jobs:
with:
extra_nix_config: |
experimental-features = nix-command flakes
+ # Container-based NixOS integration tests (testers.nixosTest with
+ # `containers`) run under systemd-nspawn instead of QEMU: no KVM
+ # needed, much faster/cheaper. The nspawn builds require an allocated
+ # UID range and cgroup delegation, advertised here on the builder.
+ extra-experimental-features = auto-allocate-uids cgroups
+ auto-allocate-uids = true
+ extra-system-features = uid-range
substituters = s3://${{ env.NIX_CACHE_BUCKET }}?region=${{ env.AWS_REGION }} https://cache.nixos.org
trusted-substituters = s3://${{ env.NIX_CACHE_BUCKET }}?region=${{ env.AWS_REGION }}
trusted-public-keys = ${{ steps.nix-key.outputs.public_key }} cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
@@ -99,7 +106,7 @@ jobs:
if (pngs.length > 0) {
const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
- body += `Screenshot captured by cua-driver's \`get_window_state\` tool from inside a NixOS VM.\n\n`;
+ body += `Screenshot captured by cua-driver's \`get_window_state\` tool from inside a NixOS container.\n\n`;
body += `πŸ“Έ [Download screenshot artifact](${artifactUrl})\n\n`;
body += 'βœ… Test passed\n';
} else {
diff --git a/flake.lock b/flake.lock
index c5e45dfd0f..ece13ab181 100644
--- a/flake.lock
+++ b/flake.lock
@@ -20,16 +20,16 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1779560665,
- "narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
+ "lastModified": 1780902259,
+ "narHash": "sha256-q8yYEC5f1mFlQO9RGna4LTc9QrcvWunX6FYp83munkQ=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
+ "rev": "bd0ff2d3eac24699c3664d5966b9ef36f388e2ca",
"type": "github"
},
"original": {
"owner": "NixOS",
- "ref": "nixos-unstable",
+ "ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
diff --git a/flake.nix b/flake.nix
index e71408b203..b15c2103ac 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,7 +2,7 @@
description = "CUA - Computer Use Agent";
inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
flake-utils.url = "github:numtide/flake-utils";
};
@@ -21,7 +21,17 @@
(
system:
let
- pkgs = import nixpkgs { inherit system; };
+ pkgs = import nixpkgs {
+ inherit system;
+ # Several Electron-based apps in the background-GUI test matrix
+ # (logseq, joplin, zettlr) pin Electron releases that nixos-26.05
+ # flags as EOL/insecure. These are read-only smoke tests running in
+ # throwaway CI containers, so permit insecure Electron specifically
+ # (version-agnostic, so a nixpkgs bump to a newer EOL Electron keeps
+ # working without editing an exact version string here).
+ config.allowInsecurePredicate =
+ pkg: nixpkgs.lib.hasPrefix "electron" (nixpkgs.lib.getName pkg);
+ };
rustSrc = ./libs/cua-driver/rust;
@@ -41,7 +51,7 @@
cua-driver-build = cuaDriverPackage;
}
// pkgs.lib.optionalAttrs (system == "x86_64-linux") {
- # NixOS VM integration test (x86_64-linux only)
+ # NixOS container integration test (x86_64-linux only)
cua-driver-integration = import ./nix/cua-driver/tests/integration.nix {
inherit pkgs;
inherit (pkgs) lib;
@@ -136,8 +146,10 @@
# focus-free WRITE / typed-text assertions are added later via
# trajectories). chromium keeps the full CDP focus-free-write
# override; tk is the negative-control full entry (Tk `send`).
- # "firefox" remains disabled: under the emulated CI VM (no KVM)
- # it does not surface its window within the launch timeout.
+ # "firefox" remains disabled: historically it did not surface its
+ # window within the launch timeout in CI. Container tests run at
+ # native speed, so this may now pass β€” left disabled pending
+ # verification.
) [
"chromium"
"tk"
@@ -145,9 +157,10 @@
"gtk3-gedit"
"gtk3-mousepad"
# gtk3-geany / gtk3-abiword temporarily disabled: their huge
- # AT-SPI trees make the bounds walk + recorder grind in the
- # emulated CI VM and the jobs time out. Re-enable once the
- # walk is fast enough for 700+-node trees.
+ # AT-SPI trees made the bounds walk + recorder grind in the
+ # previous emulated VM and the jobs timed out. Container tests run
+ # at native speed, so this may now pass β€” re-enable once verified
+ # fast enough for 700+-node trees.
# "gtk3-geany"
"gtk3-scite"
# "gtk3-abiword"
diff --git a/nix/cua-driver/tests/integration.nix b/nix/cua-driver/tests/integration.nix
index 3367123ed0..c391385147 100644
--- a/nix/cua-driver/tests/integration.nix
+++ b/nix/cua-driver/tests/integration.nix
@@ -1,6 +1,6 @@
# CUA Driver Integration Test
#
-# Tests the cua-driver MCP server end-to-end in a NixOS VM with Xvfb.
+# Tests the cua-driver MCP server end-to-end in a NixOS container with Xvfb.
# Verifies CLI subcommands, MCP protocol handshake, and tool invocation.
#
# To run: nix build .#checks.x86_64-linux.cua-driver-integration
@@ -139,7 +139,7 @@ pkgs.testers.nixosTest {
maintainers = [ ];
};
- nodes.machine =
+ containers.machine =
{
config,
pkgs,
@@ -148,10 +148,6 @@ pkgs.testers.nixosTest {
}:
{
imports = [ cuaDriverModule ];
- virtualisation = {
- cores = 2;
- memorySize = 2048;
- };
services.cua-driver.enable = true;
environment.systemPackages = with pkgs; [
xorg.xorgserver # Xvfb for headless X11
@@ -162,6 +158,9 @@ pkgs.testers.nixosTest {
};
testScript = ''
+ # cache-bust 2026-06-08.1: this comment is part of the test derivation, so
+ # bumping it changes the output path and forces the test to actually re-run
+ # instead of being substituted from the binary cache. Bump again to re-run.
machine.start()
machine.wait_for_unit("multi-user.target")
diff --git a/nix/cua-driver/tests/linux-background-gui.nix b/nix/cua-driver/tests/linux-background-gui.nix
index 06b6ba8c72..7af374d0a6 100644
--- a/nix/cua-driver/tests/linux-background-gui.nix
+++ b/nix/cua-driver/tests/linux-background-gui.nix
@@ -47,6 +47,10 @@ let
# tests. Needs `pkgs.imagemagick` in environment.systemPackages (below).
recordGifScript = import ./record-x11-gif.nix { inherit pkgs; };
+ # openbox config with focusNew=no so background apps can't steal X focus when
+ # their window maps mid-test (see openbox-rc.nix).
+ openboxRc = import ./openbox-rc.nix { inherit pkgs; };
+
# Distinct per-app GIF name so concurrent matrix jobs and their artifacts
# never collide; the workflow's `find -L "<result>/" -name '*.gif'` picks it
# up once it has been copied into the test derivation's $out.
@@ -74,7 +78,7 @@ let
import json, os, shutil, subprocess, sys
CONVERT = "${pkgs.imagemagick}/bin/convert"
- # -annotate renders TEXT and needs an explicit font: the minimal test VM has
+ # -annotate renders TEXT and needs an explicit font: the minimal test container has
# no fontconfig-discoverable fonts, so convert exits 1 without this.
FONT = "${pkgs.dejavu_fonts}/share/fonts/truetype/DejaVuSans.ttf"
@@ -373,13 +377,12 @@ let
mkSkeleton =
{
packages,
- memoryMB ? 2048,
envExports ? "",
cmd,
windowMatch,
}:
{
- inherit packages memoryMB windowMatch;
+ inherit packages windowMatch;
skeleton = true;
launch = pkgs.writeShellScript "cua-launch-${app}.sh" ''
${envExports}
@@ -477,25 +480,22 @@ let
};
# ── Electron real apps (READ-ONLY SKELETON) ─────────────────────────────
- # Heavy Chromium embeds; given more memory and a longer CI timeout. Read-only
+ # Heavy Chromium embeds; given a longer CI timeout. Read-only
# skeleton (CDP write is exercised by the chromium full entry instead).
# marktext (steals focus on launch) and vscodium (no window headless within
# 120s) were dropped.
electron-zettlr = mkSkeleton {
packages = [ pkgs.zettlr ];
- memoryMB = 4096;
cmd = "${pkgs.zettlr}/bin/zettlr ${electronCommonFlags}";
windowMatch = "--class zettlr";
};
electron-joplin = mkSkeleton {
packages = [ pkgs.joplin-desktop ];
- memoryMB = 4096;
cmd = "${pkgs.joplin-desktop}/bin/joplin-desktop ${electronCommonFlags}";
windowMatch = "--class joplin";
};
electron-logseq = mkSkeleton {
packages = [ pkgs.logseq ];
- memoryMB = 6144;
cmd = "${pkgs.logseq}/bin/logseq ${electronCommonFlags}";
windowMatch = "--class logseq";
};
@@ -503,7 +503,6 @@ let
# ── Full entries (unchanged behaviour): chromium (CDP) + tk (send) ───────
chromium = {
packages = [ pkgs.chromium ];
- memoryMB = 4096;
cdp = true;
windowMatch = "--name cua-initial";
launch = pkgs.writeShellScript "cua-launch-chromium.sh" ''
@@ -518,7 +517,6 @@ let
};
tk = {
packages = [ tkEnv pkgs.tk ];
- memoryMB = 2048;
tksend = true;
windowMatch = "--name cua-initial";
launch = pkgs.writeShellScript "cua-launch-tk.sh" ''
@@ -876,7 +874,7 @@ let
machine.execute("touch /tmp/stop-gui-recorder")
machine.execute("timeout 60 sh -lc 'while kill -0 $(cat /tmp/record-gui.pid) 2>/dev/null; do sleep 0.2; done'")
# If the recorder (or its convert) is still grinding past the wait,
- # kill it hard so it can't thrash the VM and wedge later commands.
+ # kill it hard so it can't thrash the container and wedge later commands.
machine.execute("pkill -9 -f record-x11-gif >/dev/null 2>&1; pkill -9 -x convert >/dev/null 2>&1; pkill -9 -x import >/dev/null 2>&1; true")
machine.log(machine.execute("sh -lc 'cat /tmp/record-gui.log || true'")[1])
# Best-effort: a missing GIF (recorder/convert hiccup under load) must
@@ -946,7 +944,7 @@ let
machine.execute("touch /tmp/stop-gui-recorder")
machine.execute("timeout 60 sh -lc 'while kill -0 $(cat /tmp/record-gui.pid) 2>/dev/null; do sleep 0.2; done'")
# If the recorder (or its convert) is still grinding past the wait,
- # kill it hard so it can't thrash the VM and wedge later commands.
+ # kill it hard so it can't thrash the container and wedge later commands.
machine.execute("pkill -9 -f record-x11-gif >/dev/null 2>&1; pkill -9 -x convert >/dev/null 2>&1; pkill -9 -x import >/dev/null 2>&1; true")
machine.log(machine.execute("sh -lc 'cat /tmp/record-gui.log || true'")[1])
# Best-effort GIF copy (see skeleton path): a recorder hiccup must not
@@ -979,15 +977,10 @@ pkgs.testers.nixosTest {
name = "cua-driver-linux-background-gui-${app}-test";
meta.maintainers = [ ];
- nodes.machine =
+ containers.machine =
{ pkgs, ... }:
{
imports = [ cuaDriverModule ];
- virtualisation = {
- cores = 2;
- memorySize = selected.memoryMB;
- diskSize = 8192;
- };
services.cua-driver.enable = true;
services.dbus.enable = true;
environment.systemPackages = with pkgs; [
@@ -1008,13 +1001,16 @@ pkgs.testers.nixosTest {
};
testScript = ''
+ # cache-bust 2026-06-08.1: this comment is part of the test derivation, so
+ # bumping it changes the output path and forces the test to actually re-run
+ # instead of being substituted from the binary cache. Bump again to re-run.
machine.start()
machine.wait_for_unit("multi-user.target")
with subtest("Start X11 + session D-Bus + AT-SPI bus"):
machine.execute("Xvfb :99 -screen 0 1280x1024x24 >/tmp/xvfb.log 2>&1 &")
machine.wait_until_succeeds("test -e /tmp/.X11-unix/X99", timeout=10)
- machine.execute("DISPLAY=:99 openbox >/tmp/openbox.log 2>&1 &")
+ machine.execute("DISPLAY=:99 openbox --config-file ${openboxRc} >/tmp/openbox.log 2>&1 &")
machine.execute("DISPLAY=:99 picom --backend xrender >/tmp/picom.log 2>&1 &")
machine.succeed("mkdir -p /run/user/0 && chmod 700 /run/user/0")
machine.execute("dbus-daemon --session --address=unix:path=/tmp/cua-session-bus --fork >/tmp/dbus.log 2>&1")
diff --git a/nix/cua-driver/tests/linux-background-terminal-gif.nix b/nix/cua-driver/tests/linux-background-terminal-gif.nix
index 8f01af6aa5..949c129d8d 100644
--- a/nix/cua-driver/tests/linux-background-terminal-gif.nix
+++ b/nix/cua-driver/tests/linux-background-terminal-gif.nix
@@ -127,23 +127,23 @@ let
'';
recordGifScript = import ./record-x11-gif.nix { inherit pkgs; };
+
+ # openbox config with focusNew=no (see openbox-rc.nix) so focus stays on the
+ # control terminal when the target xterm maps.
+ openboxRc = import ./openbox-rc.nix { inherit pkgs; };
in
pkgs.testers.nixosTest {
name = "cua-driver-linux-background-terminal-gif-test";
meta.maintainers = [ ];
- nodes.machine =
+ containers.machine =
{
pkgs,
...
}:
{
imports = [ cuaDriverModule ];
- virtualisation = {
- cores = 2;
- memorySize = 2048;
- };
services.cua-driver.enable = true;
environment.systemPackages = with pkgs; [
xorg.xorgserver
@@ -159,13 +159,16 @@ pkgs.testers.nixosTest {
};
testScript = ''
+ # cache-bust 2026-06-08.1: this comment is part of the test derivation, so
+ # bumping it changes the output path and forces the test to actually re-run
+ # instead of being substituted from the binary cache. Bump again to re-run.
machine.start()
machine.wait_for_unit("multi-user.target")
with subtest("Start X11 desktop and target/control xterms"):
machine.execute("Xvfb :99 -screen 0 1280x1024x24 >/tmp/xvfb.log 2>&1 &")
machine.wait_until_succeeds("test -e /tmp/.X11-unix/X99", timeout=10)
- machine.execute("DISPLAY=:99 openbox >/tmp/openbox.log 2>&1 &")
+ machine.execute("DISPLAY=:99 openbox --config-file ${openboxRc} >/tmp/openbox.log 2>&1 &")
machine.execute("DISPLAY=:99 picom --backend xrender >/tmp/picom.log 2>&1 &")
machine.execute("sh -lc \"DISPLAY=:99 xterm -T 'Background Target' -fa Monospace -fs 14 -geometry 70x24+40+120 >/tmp/background-target.log 2>&1 & echo \\$! >/tmp/background-target-pid.txt\"")
machine.execute("sh -lc \"DISPLAY=:99 xterm -T 'Background Control' -fa Monospace -fs 14 -geometry 70x24+690+120 >/tmp/background-control.log 2>&1 & echo \\$! >/tmp/background-control-pid.txt\"")
@@ -194,7 +197,7 @@ pkgs.testers.nixosTest {
active = machine.succeed("DISPLAY=:99 xdotool getactivewindow").strip()
assert control == active, f"expected active window {control}, got {active}"
- with subtest("Copy GIF out of the VM"):
+ with subtest("Copy GIF out of the container"):
machine.copy_from_machine("/tmp/cua-driver-linux-background-terminal.gif", "")
'';
}
diff --git a/nix/cua-driver/tests/linux-cursor-click-gif.nix b/nix/cua-driver/tests/linux-cursor-click-gif.nix
index 6ee3f96347..d847d538fb 100644
--- a/nix/cua-driver/tests/linux-cursor-click-gif.nix
+++ b/nix/cua-driver/tests/linux-cursor-click-gif.nix
@@ -115,23 +115,23 @@ let
'';
recordGifScript = import ./record-x11-gif.nix { inherit pkgs; };
+
+ # openbox config with focusNew=no (see openbox-rc.nix) so the control terminal
+ # keeps X focus when the second xterm maps.
+ openboxRc = import ./openbox-rc.nix { inherit pkgs; };
in
pkgs.testers.nixosTest {
name = "cua-driver-linux-cursor-click-gif-test";
meta.maintainers = [ ];
- nodes.machine =
+ containers.machine =
{
pkgs,
...
}:
{
imports = [ cuaDriverModule ];
- virtualisation = {
- cores = 2;
- memorySize = 2048;
- };
services.cua-driver.enable = true;
environment.systemPackages = with pkgs; [
xorg.xorgserver
@@ -147,13 +147,16 @@ pkgs.testers.nixosTest {
};
testScript = ''
+ # cache-bust 2026-06-08.1: this comment is part of the test derivation, so
+ # bumping it changes the output path and forces the test to actually re-run
+ # instead of being substituted from the binary cache. Bump again to re-run.
machine.start()
machine.wait_for_unit("multi-user.target")
with subtest("Start X11 desktop and two xterms"):
machine.execute("Xvfb :99 -screen 0 1280x1024x24 >/tmp/xvfb.log 2>&1 &")
machine.wait_until_succeeds("test -e /tmp/.X11-unix/X99", timeout=10)
- machine.execute("DISPLAY=:99 openbox >/tmp/openbox.log 2>&1 &")
+ machine.execute("DISPLAY=:99 openbox --config-file ${openboxRc} >/tmp/openbox.log 2>&1 &")
machine.execute("DISPLAY=:99 picom --backend xrender >/tmp/picom.log 2>&1 &")
machine.execute("sh -lc \"DISPLAY=:99 xterm -T 'Target Click' -fa Monospace -fs 14 -geometry 70x24+80+120 >/tmp/target-click.log 2>&1 & echo \\$! >/tmp/target-click-pid.txt\"")
machine.execute("sh -lc \"DISPLAY=:99 xterm -T 'Control Click' -fa Monospace -fs 14 -geometry 70x24+700+120 >/tmp/control-click.log 2>&1 & echo \\$! >/tmp/control-click-pid.txt\"")
@@ -177,7 +180,7 @@ pkgs.testers.nixosTest {
machine.succeed("test -s /tmp/cua-driver-linux-cursor-click.gif")
machine.wait_until_succeeds("test -f /tmp/click-focus.txt", timeout=20)
- with subtest("Copy GIF out of the VM"):
+ with subtest("Copy GIF out of the container"):
machine.copy_from_machine("/tmp/cua-driver-linux-cursor-click.gif", "")
'';
}
diff --git a/nix/cua-driver/tests/openbox-rc.nix b/nix/cua-driver/tests/openbox-rc.nix
new file mode 100644
index 0000000000..5ca8b439d1
--- /dev/null
+++ b/nix/cua-driver/tests/openbox-rc.nix
@@ -0,0 +1,29 @@
+# Shared openbox config for the X11 GUI tests.
+#
+# Returns an openbox rc.xml whose only non-default setting is
+# `<focus><focusNew>no</focusNew></focus>`: openbox must NOT auto-focus a
+# window when it is first mapped. Everything else falls back to openbox's
+# built-in defaults (missing nodes are defaulted by the parser).
+#
+# Why: the background-GUI tests launch a real app (chromium/electron) in the
+# background while a control terminal stays focused, then assert focus never
+# left the control terminal. Under the faster container backend, chromium-based
+# apps finish loading and map/raise their toplevel mid-test; with the default
+# `focusNew=yes` openbox would shift X input focus to the freshly-mapped window
+# and break that invariant. Explicit `xdotool windowactivate` requests are user
+# actions and are still honoured, so the control terminal is still focusable.
+#
+# Usage (in a test's `let`):
+# openboxRc = import ./openbox-rc.nix { inherit pkgs; };
+# then launch openbox with it:
+# openbox --config-file ${openboxRc}
+{ pkgs }:
+
+pkgs.writeText "openbox-rc.xml" ''
+ <?xml version="1.0" encoding="UTF-8"?>
+ <openbox_config xmlns="http://openbox.org/3.4/rc">
+ <focus>
+ <focusNew>no</focusNew>
+ </focus>
+ </openbox_config>
+''
diff --git a/nix/cua-driver/tests/record-x11-gif.nix b/nix/cua-driver/tests/record-x11-gif.nix
index c62c744fc9..81a49a9001 100644
--- a/nix/cua-driver/tests/record-x11-gif.nix
+++ b/nix/cua-driver/tests/record-x11-gif.nix
@@ -30,7 +30,7 @@ pkgs.writeShellScript "record-x11-gif.sh" ''
# Cap the frame count: long driver runs (the skeleton budget is 300s) can
# otherwise pile up 1000+ frames and the final `convert` thrashes/OOMs the
- # 2GB test VM, wedging every later command in the job. 450 frames is a ~45s
+ # test container, wedging every later command in the job. 450 frames is a ~45s
# GIF at the default cadence β€” plenty. Each `import` and the final `convert`
# are also time-bounded so a wedged X grab or a slow stitch can't stall the
# job.
diff --git a/nix/cua-driver/tests/screenshot.nix b/nix/cua-driver/tests/screenshot.nix
index 88068832da..695983e407 100644
--- a/nix/cua-driver/tests/screenshot.nix
+++ b/nix/cua-driver/tests/screenshot.nix
@@ -2,7 +2,8 @@
#
# Runs the integration test and then uses cua-driver's own get_window_state
# tool to capture a screenshot of an xterm window via MCP. The screenshot
-# is extracted as a PNG from the base64 MCP response and copied out of the VM.
+# is extracted as a PNG from the base64 MCP response and copied out of the
+# container.
#
# To run: nix build .#checks.x86_64-linux.cua-driver-screenshot
#
@@ -179,6 +180,10 @@ let
sleep infinity
'';
+ # openbox config with focusNew=no (see openbox-rc.nix) so the xterm under test
+ # keeps X focus when it maps.
+ openboxRc = import ./openbox-rc.nix { inherit pkgs; };
+
in
pkgs.testers.nixosTest {
@@ -187,7 +192,7 @@ pkgs.testers.nixosTest {
maintainers = [ ];
};
- nodes.machine =
+ containers.machine =
{
config,
pkgs,
@@ -196,10 +201,6 @@ pkgs.testers.nixosTest {
}:
{
imports = [ cuaDriverModule ];
- virtualisation = {
- cores = 2;
- memorySize = 2048;
- };
services.cua-driver.enable = true;
environment.systemPackages = with pkgs; [
xorg.xorgserver
@@ -214,6 +215,9 @@ pkgs.testers.nixosTest {
};
testScript = ''
+ # cache-bust 2026-06-08.1: this comment is part of the test derivation, so
+ # bumping it changes the output path and forces the test to actually re-run
+ # instead of being substituted from the binary cache. Bump again to re-run.
machine.start()
machine.wait_for_unit("multi-user.target")
@@ -229,13 +233,13 @@ pkgs.testers.nixosTest {
machine.execute("Xvfb :99 -screen 0 1280x1024x24 >/dev/null 2>&1 &")
machine.wait_until_succeeds("test -e /tmp/.X11-unix/X99", timeout=10)
# Start openbox WM so _NET_CLIENT_LIST is populated for list_windows
- machine.execute("DISPLAY=:99 openbox >/dev/null 2>&1 &")
+ machine.execute("DISPLAY=:99 openbox --config-file ${openboxRc} >/dev/null 2>&1 &")
# Start compositing manager so X11 GetImage returns rendered pixels
machine.execute("DISPLAY=:99 picom --backend xrender >/dev/null 2>&1 &")
machine.copy_from_host("${testPage}", "/tmp/test-page.sh")
machine.succeed("chmod +x /tmp/test-page.sh")
machine.execute("DISPLAY=:99 xterm -T 'CUA Test' -fa Monospace -fs 14 -geometry 60x20+100+100 -e /tmp/test-page.sh >/dev/null 2>&1 &")
- # Wait for xterm window to appear (poll via xdotool inside the VM)
+ # Wait for xterm window to appear (poll via xdotool inside the container)
machine.wait_until_succeeds("DISPLAY=:99 xdotool search --class xterm", timeout=15)
# Save the xterm window ID and PID for the MCP screenshot test
machine.succeed("DISPLAY=:99 xdotool search --class xterm | head -1 > /tmp/xterm-xid.txt")
@@ -254,7 +258,7 @@ pkgs.testers.nixosTest {
assert "Screenshot test complete" in result, f"Test did not complete: {result}"
with subtest("Extract screenshot"):
- # Copy screenshot out of VM if it exists
+ # Copy screenshot out of the container if it exists
machine.succeed("test -f /tmp/cua-driver-screenshot.png || test -f /tmp/cua-driver-response.json")
machine.copy_from_machine("/tmp/cua-driver-screenshot.png", "")
'';
diff --git a/nix/cua-driver/tests/set-config.nix b/nix/cua-driver/tests/set-config.nix
index 541f109c1f..ef4cd84862 100644
--- a/nix/cua-driver/tests/set-config.nix
+++ b/nix/cua-driver/tests/set-config.nix
@@ -3,9 +3,9 @@
# Regression test for #1923 (fixed in PR #1928): on Linux the `set_config`
# tool only read the legacy per-field keys, so a `{"key":..., "value":...}`
# write (the shape the Swift/macOS and Windows callers send) was silently
-# dropped. This boots a NixOS VM, drives the driver over MCP stdio, writes
-# config via the `{key, value}` shape, then reads it back with `get_config`
-# and asserts the new value persisted.
+# dropped. This boots a NixOS container, drives the driver over MCP stdio,
+# writes config via the `{key, value}` shape, then reads it back with
+# `get_config` and asserts the new value persisted.
#
# To run: nix build .#checks.x86_64-linux.cua-driver-set-config
#
@@ -143,7 +143,7 @@ pkgs.testers.nixosTest {
maintainers = [ ];
};
- nodes.machine =
+ containers.machine =
{
config,
pkgs,
@@ -152,10 +152,6 @@ pkgs.testers.nixosTest {
}:
{
imports = [ cuaDriverModule ];
- virtualisation = {
- cores = 2;
- memorySize = 2048;
- };
services.cua-driver.enable = true;
environment.systemPackages = with pkgs; [
xorg.xorgserver # Xvfb for headless X11
@@ -164,6 +160,9 @@ pkgs.testers.nixosTest {
};
testScript = ''
+ # cache-bust 2026-06-08.1: this comment is part of the test derivation, so
+ # bumping it changes the output path and forces the test to actually re-run
+ # instead of being substituted from the binary cache. Bump again to re-run.
machine.start()
machine.wait_for_unit("multi-user.target")