garage44.eu/jeroen/midas

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

.. /docs/macos-nodes.md

raw

macOS nodes

For iOS builds on a Mac (Apple silicon). Built, but not yet run on a Mac: the first setup on the real machine is also its test (see the end).

How it works

macOS has nothing container-like that can run Xcode safely (Apple's container runs Linux only; Darwin chroot needs System Integrity Protection off on the host), so a macOS node is a virtual machine, run by Tart on Apple's Virtualization framework. A VM has its own kernel: a stronger boundary than the Linux nodes' containers. The rest is the same idea as on Linux (development.md):

LinuxmacOS
runs asuser midas-nodeuser midas-node (hidden, no login)
noderootless podman containerTart VM, started at boot by launchd
boundary on the machinenftables, keyed on the usera 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 tunnelonly the node's ssh portthe same
limitscgroupsthe VM's CPUs and memory
imageContainerfile compiled into midasa 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
portspastamidas 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
updatesre-run setupthe same: the VM installs the owner's midas from a read-only shared folder at every start

Apple's licence allows two macOS VMs per Mac, for software development: two nodes at most. On 64 GB, two nodes of 24 GB (the default) leave room for the host. No signing identities belong in a node; nodes build unsigned and simulator artefacts.

Setting one up

On the Mac, as an admin:

brew install cirruslabs/cli/tart hashicorp/tap/packer rustup
rustup default stable
git clone <the midas repository> && cd midas && cargo build --release
sudo install -d -m 755 /var/lib/midas/bin
sudo install -m 755 target/release/midas /var/lib/midas/bin/midas

WireGuard up with the Mac's workspace address (the official app, or wireguard-tools). An agent adds the node — a second node on the same Mac is the same with another name (it gets the next port):

midas nodes add mac-1 --machine mini --address 10.44.0.4 --renderer "Apple M5 Pro (VM)"

Then, on the Mac:

sudo /var/lib/midas/bin/midas setup mac-1 --hub 10.44.0.1:4791

Options: --memory 24g, --cpus 6, --disk 200 (GB), --image <tart image>, --rebuild (a new VM from the image; its warm build directory starts over), --remove. The first run downloads the image (tens of GB) and builds the VM.

What the warmer builds on a Mac goes in the hub's hub.conf, under warm.machines.<machine> (steps, optional), since the iOS target is not what the Linux nodes build.

To check on the first real setup