Rust builder
The world cargo sends POST http://host.sausage/cargo with argv, cwd, and optional timeout_secs.
The response contains newline-delimited JSON events.
stdout and stderr events contain byte arrays. The final exit event contains a code and executable paths.
The CLI forwards the bytes immediately. For test and run, it executes the artifacts through the process interface.
For test and run, arguments after -- belong to the executable, not the host build.
Other commands retain their -- arguments, such as fmt -- --check and Clippy lint options.
The host finds the Cargo workspace above the requested directory and copies its sources through the shared VFS.
It excludes target and .git.
Each workspace owns a source copy, target directory, registry, and kache cache.
These directories live under <dir>/host/builds/.
Cargo fetches dependencies with network access. The command then runs offline inside bubblewrap namespaces. Only the source copy, target, and private kache cache permit writes. The registry and Nix store remain read-only. HOME and the host network are absent. The PID namespace removes compiler descendants and the private kache daemon after Cargo exits.
The builder copies changed and new source files back through the VFS.
It preserves other source files, including concurrent edits in the world.
It publishes WASI executables into the world's workspace target directory.
After cargo clean, it removes the published artifacts that Cargo removed from the native target.
Every target build uses wasm32-wasip2 and links the shared cwd-init object, including its numeric exit-code interface.
The host rejects other build targets and --target-dir overrides.
The command deadline defaults to 30 minutes. The host kills timed-out commands before it sends their timeout message. A closed response cancels the native command and its process group.
The host retains at most 20 GiB of build directories and evicts the oldest workspace first.
The Nix wrapper supplies these tools on PATH:
- Rust and the native compiler
- The WASI C tools
- Bubblewrap
- Nushell
- wasm-tools
- Kache
- Bash and Coreutils
Kache comes from the upstream flake at revision 96052b4842239bb216f6c4812054203c21550788.
The development shell supplies the same builder tools.
The builder resolves the wrapper and interpreter paths to their canonical Nix store paths.
The embedded cwd-init sources produce a startup object and a linker script inside each workspace's tool folder.
The linker script uses the canonical Nushell interpreter, so it needs no host /usr/bin/env.
The sandbox exposes Bash at /bin/sh for native build scripts.
It does not depend on a user-profile path or a host HOME file.
Development commands retain the global Cargo configuration and its kache wrapper.
The sandbox uses a private Cargo home and selects kache through --config build.rustc-wrapper.
For cargo add, the network phase performs a dry run to populate the registry index.
The offline command makes the actual manifest change inside the namespaces.
The disk cap applies after each completed command, including compiler failures.