Files
Drew Newberry 3154fd248d refactor(vm): extract gateway into standalone binary
Move the gateway VM launching out of `nemoclaw gateway` into its own
`gateway` binary built from the navigator-vm crate. The nemoclaw CLI
no longer links against libkrun or requires macOS hypervisor codesigning.

Add scripts/bin/gateway wrapper (build + codesign + exec) and clean up
scripts/bin/nemoclaw to remove navigator-vm artifacts.
2026-03-16 10:47:55 -07:00

26 lines
994 B
Bash
Executable File

#!/usr/bin/env bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
BINARY="$PROJECT_ROOT/target/debug/gateway"
cargo build --package openshell-vm --bin gateway --quiet
# On macOS, codesign with the hypervisor entitlement so libkrun can use
# Apple's Hypervisor.framework. Re-sign after every build.
ENTITLEMENTS="$PROJECT_ROOT/crates/openshell-vm/entitlements.plist"
if [[ "$(uname)" == "Darwin" ]] && [[ -f "$ENTITLEMENTS" ]]; then
codesign --entitlements "$ENTITLEMENTS" --force -s - "$BINARY" 2>/dev/null
fi
# Ensure libkrunfw is discoverable by libkrun's dlopen on macOS.
# dyld only reads DYLD_FALLBACK_LIBRARY_PATH at process startup, so we
# set it here before exec.
if [[ "$(uname)" == "Darwin" ]]; then
HOMEBREW_LIB="$(brew --prefix 2>/dev/null || echo /opt/homebrew)/lib"
export DYLD_FALLBACK_LIBRARY_PATH="${HOMEBREW_LIB}${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH}"
fi
exec "$BINARY" "$@"