garage44.eu/jeroen/midas

logclone: git clone https://garage44.eu/jeroen/midas.git

cartopolis-agent · 2026-11-23T21:37:24Z

feat(node): QEMU on macOS nodes, for pinnacle's boot tests

Pinnacle's gate, demos and `cargo xtask https` boot its kernel in
qemu-system-aarch64, which only the Linux nodes had (the Containerfile),
so every boot test waited for vps-1 while mac-2 sat free: on mac-2 the
gate built, linted and tested everything, then stopped at "No such
file or directory (is QEMU installed?)".

A new macOS node gets Homebrew's qemu with its other tools
(provision.sh); one that lacks it installs it in the background when
its start job runs (start.sh), as bun was added, so mac-1 and mac-2
take it without a rebuild that would lose their warm builds.
docs/macos-nodes.md           | 2 +-
 node/macos/guest/provision.sh | 6 ++++--
 node/macos/guest/start.sh     | 4 ++++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/docs/macos-nodes.md b/docs/macos-nodes.md
index fc497be..0fd9d0c 100644
--- a/docs/macos-nodes.md
+++ b/docs/macos-nodes.md
@@ -19,7 +19,7 @@ than the Linux nodes' containers. The rest is the same idea as on Linux
 | boundary on the machine | nftables, keyed on the user | a pf anchor, loaded at boot: the VMs' network may reach this Mac only on the two forwarded hub ports, DNS and DHCP, and nothing private at all; no IPv6 |
 | from the tunnel | only the node's ssh port | the same |
 | limits | cgroups | the VM's CPUs and memory |
-| image | Containerfile compiled into midas | a Packer template compiled into midas: Cirrus Labs' macOS with Xcode, plus Rust (`aarch64-apple-ios`, `aarch64-apple-ios-sim`), git-lfs, and sshd hooked into midas |
+| image | Containerfile compiled into midas | a Packer template compiled into midas: Cirrus Labs' macOS with Xcode, plus Rust (`aarch64-apple-ios`, `aarch64-apple-ios-sim`), git-lfs, bun, QEMU (for a bare-metal kernel such as pinnacle's), and sshd hooked into midas |
 | ports | pasta | `midas node forward`, as the node's user: tunnel → VM's sshd, and VM → hub (`<gateway>:4791` → the API, `:4792` → git), so the hub sees the node at this Mac's WireGuard address |
 | updates | re-run setup | the same: the VM installs the owner's midas from a read-only shared folder at every start |
 
diff --git a/node/macos/guest/provision.sh b/node/macos/guest/provision.sh
index fbc3b1a..eee1e87 100755
--- a/node/macos/guest/provision.sh
+++ b/node/macos/guest/provision.sh
@@ -30,8 +30,10 @@ grep -q '^work' /etc/synthetic.conf 2>/dev/null || printf 'work\tUsers/build/wor
 grep -q '^config' /etc/synthetic.conf 2>/dev/null || printf 'config\tusr/local/etc/midas\n' >> /etc/synthetic.conf
 /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true
 
-# Tools. Homebrew belongs to the base image's admin user.
-sudo -u admin -H /opt/homebrew/bin/brew install git-lfs rsync oven-sh/bun/bun >/dev/null
+# Tools. Homebrew belongs to the base image's admin user. QEMU boots a
+# bare-metal kernel a project builds (pinnacle) and checks what it prints,
+# as on Linux nodes.
+sudo -u admin -H /opt/homebrew/bin/brew install git-lfs rsync oven-sh/bun/bun qemu >/dev/null
 install -d /usr/local/bin
 # sshd runs its AuthorizedKeysCommand (/usr/local/bin/midas) only from a path
 # no other user can write, and the base image gives /usr/local/bin to admin.
diff --git a/node/macos/guest/start.sh b/node/macos/guest/start.sh
index 26d7446..fb15dc5 100755
--- a/node/macos/guest/start.sh
+++ b/node/macos/guest/start.sh
@@ -39,6 +39,10 @@ if [ ! -x /opt/homebrew/bin/bun ]; then
     (sudo -u admin -H /opt/homebrew/bin/brew install oven-sh/bun/bun >/dev/null 2>&1 \
         && echo "midas node: bun installed" || echo "midas node: could not install bun" >&2) &
 fi
+if [ ! -x /opt/homebrew/bin/qemu-system-aarch64 ]; then
+    (sudo -u admin -H /opt/homebrew/bin/brew install qemu >/dev/null 2>&1 \
+        && echo "midas node: qemu installed" || echo "midas node: could not install qemu" >&2) &
+fi
 for _ in $(seq 1 60); do
     [ -f "$share/node.env" ] && break
     # Tart's shared folders mount themselves; if not yet, ask.