Skip to main content

Module vm

Module vm 

Source
Expand description

Optional session-scoped VM execution (γ CLI / β sidecar): host SessionHolder::Host, Unix γ SessionHolder::Gamma.

Re-exports§

pub use sync::pull_workspace_to_vfs;
pub use sync::push_full;
pub use sync::push_incremental;
pub use sync::VmSyncError;

Modules§

sync
Push/pull between VFS and a persistent host workspace directory (session VM staging).

Structs§

GammaSession
Lima-backed session: sync VFS ↔ host workspace, run tools inside the VM.
HostSandboxSession
Runs rustup/cargo via temp directory export + sync (no persistent VM).
LimaGuestFsOps
Owns a γ GammaSession for GuestFsOps tests and harnesses (delegates to GuestFsOps for GammaSession).
MockGuestFsOps
In-memory GuestFsOps for unit tests (no VM).
VmConfig
Parsed VM-related environment.
VmSessionInitError
Session-construction error already reported to stderr by try_session_rc.

Enums§

GuestFsError
Errors from GuestFsOps (guest path / remote command).
SessionHolder
Active VM / sandbox backend for one REPL or script run.
VmError
Errors from VM session operations.
WorkspaceMode
How the devshell workspace is backed: memory VFS + push/pull (WorkspaceMode::Sync) vs guest-primary (WorkspaceMode::Guest, planned).

Constants§

ENV_DEVSHELL_VM
DEVSHELL_VMRelease / binary default: unset means on (use VM backend per ENV_DEVSHELL_VM_BACKEND).
ENV_DEVSHELL_VM_AUTO_BUILD_ESSENTIAL
When unset or truthy (default): after the VM is running, probe for gcc in the guest and, if
ENV_DEVSHELL_VM_AUTO_BUILD_TODO_GUEST
When 1/true/yes: if guest lacks todo but Cargo workspace is under the Lima mount, run cargo build -p xtask --release --bin todo in the guest (slow; needs cargo + toolchain). Default: off.
ENV_DEVSHELL_VM_AUTO_TODO_PATH
When unset or truthy (default): if target/release from cargo metadata (host cwd) lies under the
ENV_DEVSHELL_VM_BACKEND
Backend selector: host, auto, lima, beta, …
ENV_DEVSHELL_VM_BETA_SESSION_STAGING
When set (non-empty), β session_start sends this string as staging_dir to the sidecar instead of
ENV_DEVSHELL_VM_CONTAINER_IMAGE
Windows β: OCI image used when no host Linux devshell-vm ELF is found: podman run -i with
ENV_DEVSHELL_VM_DISABLE_PODMAN_SSH_HOME
When set (any value), do not isolate USERPROFILE / HOME for podman subprocesses (Windows).
ENV_DEVSHELL_VM_EAGER
When 1/true/yes, start the VM session eagerly (future γ); default is lazy start on first rust tool.
ENV_DEVSHELL_VM_EXEC_TIMEOUT_MS
β 侧车 exec 若设为正整数,作为毫秒超时(与 JSON timeout_ms 二选一/叠加见 devshell-vm)。0 或未设置表示不限制(仅受宿主/客户端是否在 JSON 里传 timeout_ms 约束)。
ENV_DEVSHELL_VM_GUEST_HOST_DIR
Name of a symlink in the guest $HOME pointing at the host current_dir project (default: host_dir).
ENV_DEVSHELL_VM_GUEST_TODO_HINT
When unset or truthy (default): before limactl shell, probe guest for todo and print install hints if missing. Set to 0/false/no/off to skip.
ENV_DEVSHELL_VM_GUEST_WORKSPACE
Guest mount point for that directory (default /workspace).
ENV_DEVSHELL_VM_LIMACTL
Override path to limactl (default: PATH).
ENV_DEVSHELL_VM_LIMA_HINTS
Set to 0/false/no/off to silence Lima configuration hints.
ENV_DEVSHELL_VM_LIMA_INSTANCE
Lima instance name for γ (limactl shell <name>).
ENV_DEVSHELL_VM_LINUX_BINARY
Windows β: optional full Windows path to the Linux devshell-vm binary (x86_64-unknown-linux-gnu / ELF) for podman machine ssh transport.
ENV_DEVSHELL_VM_REPO_ROOT
Windows β: optional Windows path to an xtask_todo repository root (directory containing
ENV_DEVSHELL_VM_SKIP_PODMAN_BOOTSTRAP
When set (any value), skip podman machine ssh bootstrap on Windows: no Podman check / no requirement that the Linux devshell-vm binary exists (tests or fully manual β setup).
ENV_DEVSHELL_VM_SOCKET
Unix socket path for β client ↔ devshell-vm --serve-socket (see IPC draft).
ENV_DEVSHELL_VM_STDIO_TRANSPORT
Windows β: stdio transport for DEVSHELL_VM_SOCKET=stdio: auto (default), machine-ssh (host ELF + podman machine ssh), or podman-run (OCI image + podman run -i).
ENV_DEVSHELL_VM_STOP_ON_EXIT
When set truthy, run limactl stop on session shutdown.
ENV_DEVSHELL_VM_WORKSPACE_MODE
DEVSHELL_VM_WORKSPACE_MODEsync (default) or guest (Mode P; guest filesystem as source of truth).
ENV_DEVSHELL_VM_WORKSPACE_PARENT
Host directory we push/pull (must be mounted at super::GammaSession::guest_mount in the Lima VM).
ENV_DEVSHELL_VM_WORKSPACE_USE_CARGO_ROOT
When unset or truthy (default): if ENV_DEVSHELL_VM_WORKSPACE_PARENT is unset, resolve the host

Traits§

GuestFsOps
Operations on the guest filesystem (Mode P). Paths are guest absolute paths (e.g. /workspace/foo).
VmExecutionSession
Abstraction for a devshell execution session (host temp dir, γ VM, or β sidecar).

Functions§

exec_timeout_ms_from_env
Reads ENV_DEVSHELL_VM_EXEC_TIMEOUT_MS: positive integer milliseconds for β exec JSON timeout_ms, or None if unset, invalid, or zero.
export_devshell_workspace_root_env
guest_path_is_under_mount
True if path is mount or a strict descendant (after normalization). mount is e.g. /workspace.
guest_project_dir_on_guest
Guest directory for the current logical cwd (γ layout: guest_mount + last segment of logical_cwd). Same rule as guest_dir_for_cwd_inner in session_gamma / push layout.
normalize_guest_path
Lexically normalize an absolute Unix-style path (no symlink resolution).
should_delegate_lima_shell
try_session_rc
Build SessionHolder from the environment.
try_session_rc_or_host
Like try_session_rc, but on failure uses SessionHolder::Host so the REPL can run against workspace_parent_for_instance (same tree as the Lima mount).
vm_workspace_host_root
Host directory that Lima mounts at the guest workspace (e.g. /workspace).
workspace_mode_from_env
Read ENV_DEVSHELL_VM_WORKSPACE_MODE from the environment.
workspace_parent_for_instance
Host workspace root shared with the VM / β staging tree (see docs/devshell-vm-gamma.md).