README.md

native — Virtualization.framework bridge #

A Rust cdylib exposed to Electron's main process through napi-rs. Build it with bun run build:native, which writes native/code-browser-vz.node.

  • src/vz.rs: VM lifecycle (create/start/stop/pause/save/restore) and vsock connect.
  • src/lib.rs: napi exports (feature node). Currently isSupported() only.
  • src/bin/vzbench.rs: boot benchmark and one-shot exec, needing the guest from bun run build:guest:
cargo build --release --no-default-features --bin vzbench
codesign -f -s - --entitlements entitlements.plist target/release/vzbench
target/release/vzbench cold --runs 10 [--parallel 4] [--cpus 2 --mem 512]
target/release/vzbench restore --runs 5
target/release/vzbench exec [--repo DIR] -- sh -c 'uname -a'

Results and design conclusions are in docs/ARCHITECTURE.md.

Starting a VM requires the com.apple.security.virtualization entitlement (entitlements.plist), so the Electron binary or app bundle must be signed with it. An ad-hoc signature is enough for local development.