Skip to content

Requirements and environment variables

What a machine needs to build lema and to make native calls, and every environment variable the tools and test suites read.

Building lema, running cargo test and the pinned-Lean local checks need only the toolchains below. Native calls (every acceptance by the pinned Lean 4.34.1 kernel, and every build and run of an artifact) also need the host below, and lema check-runtime reports whether a machine has it. Setting a machine up is the set-up tutorial.

Host

RequirementDetail
Operating systemLinux on x86_64. Target x86_64-unknown-linux-gnu, host kind linux-x86_64-bwrap-systemd-scope-v1.
Sandboxbubblewrap at /usr/bin/bwrap.
Scopessystemd-run --user and systemctl --user at /usr/bin, with the cpu, memory and pids cgroup controllers delegated to the user manager. The runtime reads /sys/fs/cgroup/user.slice/user-UID.slice/user@UID.service/cgroup.controllers before each call.
Pressure information/proc/meminfo, /proc/pressure/memory and /proc/pressure/cpu.
MemoryAt least 6 GiB available before each call. Each call runs in 4 GiB with no swap.
DiskAt least 4 GiB free on the runtime output’s file system and on the shared lock’s.
File system layoutMerged /usr: /bin and /sbin link to usr/bin, /lib and /lib64 to usr/lib, and /usr/lib/libcap.so.2 to libcap.so.2.78.

The limits are described in full on the runtime configuration page.

Pinned host files

Twelve host files are pinned by SHA-256 in crates/lema-check/src/pins.rs (HOST_PINS): the sandbox and systemd tools and the shared libraries that Lean, bubblewrap and the systemd tools link. Each must be a regular file owned by root, not writable by group or others, with this digest. They are the files of the project’s trusted runner host, in Arch Linux’s merged-/usr layout.

PathSHA-256
/usr/bin/bwrap7c44…4762
/usr/bin/systemd-rune14f…6339
/usr/bin/systemctlafe9…3255
/usr/lib/ld-linux-x86-64.so.2d011…1bfb
/usr/lib/libc.so.6e221…ffff
/usr/lib/libm.so.69651…999d
/usr/lib/libpthread.so.0839b…31ab
/usr/lib/libdl.so.29b38…d03c
/usr/lib/librt.so.1e06e…e5f8
/usr/lib/libcap.so.2.785a9c…c6a1
/usr/lib/libgcc_s.so.1e618…716a
/usr/lib/systemd/libsystemd-shared-261.2-1.soa913…d6f5

At HEAD 5a94951 a mismatch refuses loading the runtime and every native call, with host executable/library drift: PATH. A package update on the host therefore stops native calls until the pins are reviewed and updated. Receipts record the pins’ digest as host_pins_sha256 in their checker block. Decision 0033 plans to record the pins rather than enforce them, keeping the ownership checks; that change is not in the code yet.

Toolchains

Rust

Rust 1.98.0, pinned by rust-toolchain.toml. scripts/cloud-setup.sh installs it through rustup with the rustfmt and clippy components. cargo build --release builds target/release/lema.

Lean

The pinned Lean distribution is the official Lean 4.34.1 Linux archive, extracted read-only with the committed manifest beside it.

ItemValue
Version4.34.1
Git hash5045d0056413266e57c625dcd7c365b10e377c52
Archivelean-4.34.1-linux.tar.zst
Archive SHA-25647bf4bbd78f70c2e9670598ab7124d92b6efb7330ff33e5fbb4030f6fd72e4e4
Manifesttoolchain/lean-4.34.1-linux.extraction-manifest.json (schema lema.lean-distribution/v1), copied into the distribution as extraction-manifest.json
Manifest SHA-256c82b7b44dd02daae5aa46c3f7e0a1e564da1a183fd81c021f299370a51d297a5
bin/lean SHA-256e8baaa71855a616dc351028f3ad2200051b0671f423a1696a100e809302d5550
Contentsthe directory lean-4.34.1-linux/, 17,738 files and 12 symlinks
Archive URL
https://github.com/leanprover/lean4/releases/download/v4.34.1/lean-4.34.1-linux.tar.zst

Every file and directory of the distribution must belong to root or the running user and must not be writable by group or others. lema verify-distribution DIR checks a distribution against these pins, and so does every load of a runtime. Installing it by hand is covered in install the pinned Lean.

Build tools

scripts/cloud-setup.sh needs curl, tar, zstd, git and a C compiler (cc). When one is missing and apt-get is available as root or through sudo, it installs curl, ca-certificates, tar, zstd, git and build-essential. It also tries to install bubblewrap when bwrap is missing, and carries on if that fails.

Environment variables

Client and actors

VariableRead byMeaning
LEMA_SOCKETevery command that uses a socketThe server’s socket when --socket is not given. Without either: lema.sock in the current directory.
LEMA_ACTOR_TOKENref create, publish-revision, adopt-policy, reviewThe acting actor’s token when --token-file is not given. The token is never taken from the command line.

Setup

scripts/cloud-setup.sh reads three optional variables.

VariableMeaning
LEMA_HOMEWhere toolchains, runtime configurations and env go. Default: ~/.lema.
LEMA_DISTAn absolute path to an extracted distribution to use instead of downloading one. It must hold the committed manifest as extraction-manifest.json.
LEMA_SETUP_PREBUILD0 skips prebuilding the workspace’s tests.

It writes $LEMA_HOME/env, a file to source, which sets:

VariableValue
PATHAdds ~/.cargo/bin and Cargo’s target/release.
LEMA_DISTThe distribution the script checked, by default $LEMA_HOME/toolchains/lean-4.34.1-linux-x86_64.
LEMA_LOCAL_LEANThe pinned lean binary in that distribution.
LEMA_NATIVEyes, busy or no: what lema check-runtime reported (exit 0, 75 or anything else).
LEMA_RUNTIME_BASE$LEMA_HOME/runtime.json, the base runtime configuration (output $LEMA_HOME/evidence, lock $LEMA_HOME/native.lock).

The setup’s own check-runtime call runs in a fresh output under $LEMA_HOME/checks/.

Set by the runtime

Inside the application sandbox, LEMA_CAP_CONFIG names the deployment directory’s lema-cap.json, which the capability shims read.

Local checks without the runtime

These run the pinned toolchain directly, with no scope, lock or ledger. What they show is tested, not native acceptance.

VariableMeaningRead by
LEMA_LOCAL_LEANThe pinned lean binary.crates/lema-cli/tests/contract_view_local.rs, fueled_call_graph.rs
LEMA_CAP_SMOKE1 runs the capability boundary’s smoke test, with LEMA_CAP_LEAN_ROOT.crates/lema-cap/tests/smoke.rs
LEMA_CAP_LEAN_ROOTThe distribution root holding bin/lean and bin/leanc.smoke.rs, crates/lema-cap/tests/runner.rs
LEMA_RUNNER_LOCAL1 runs the runner’s boundary suite locally, with LEMA_CAP_LEAN_ROOT.crates/lema-cap/tests/runner.rs
LEMA_STRUCTURES_LEAN_ROOTThe distribution root holding bin/lean: checks lean/std/ReceivedStructuresCheck.lean.crates/lema-check/tests/structure_emulation.rs
LEMA_CAP_STATICLIBThe path of liblema_cap.a. Without it, the tests use the one cargo build -p lema-cap wrote in the same profile’s target directory.smoke.rs, runner.rs, crates/lema-cap/tests/native.rs, crates/lema-cli/tests/standalone.rs

Native suites

A native suite runs only when its variable names a runtime configuration. Each run gets its own output, because a fault latches the output it happens in. README.md runs them with -- --test-threads=1 on a quiet host. Test files are under crates/.

The last column marks suites of retired or on-hold parts. Decision 0033 retires the HTTP v1 chain in lean/http, the HTTP v2 server in lean/web, the M3/M4 apps kv, ledger and fanout, and the lema-host execution host, with roughly 23 native suites. Decision 0029 puts the Rust backend on hold. The files of these suites are still in the tree at HEAD. A suite that only takes the HTTP v1 draft as an input (LEMA_SCALE_HTTP_DRAFT) is not marked.

VariableRunsCompanionsRetired or on hold
LEMA_RUNTIMElema-check/tests/native.rs: native calls on an ordinary output, with a small leanc link
LEMA_FAULT_RUNTIMElema-check/tests/native.rs: a deliberate timeout
LEMA_WORKER_FAULT_RUNTIMElema-check/tests/native.rs: a worker fault
LEMA_WORKER_STALL_RUNTIMElema-check/tests/native.rs: a worker that stops reading
LEMA_WORKER_FLOOD_RUNTIMElema-check/tests/native.rs: a worker that floods its output
LEMA_REPLAY_RUNTIMElema-check/tests/replay.rs: kernel replay of canonical objects
LEMA_MODULES_RUNTIMElema-check/tests/incremental.rs: incremental replay through modules, on a fresh output
LEMA_E2E_RUNTIMElema-cli/tests/e2e.rs: Core, then a client through Received.*, then queries
LEMA_DATA_RUNTIMElema-cli/tests/data.rs, families.rs: fixed-width integers and money, single self-recursive families
LEMA_BYTES_RUNTIMElema-cli/tests/bytes.rs: lean/data/Bytes.lean and the forbidden-API list
LEMA_CORE_V2_RUNTIMElema-cli/tests/core_v2.rs: Core v2LEMA_SCALE_HTTP_DRAFT
LEMA_HANDLES_RUNTIMElema-cli/tests/handles.rs: handle-map contracts
LEMA_SUMS_RUNTIMElema-cli/tests/sums.rs: effect sums
LEMA_ACTOR_RUNTIMElema-cli/tests/actor.rs: a certified actor with a bounded mailbox
LEMA_ESCROW_RUNTIMElema-cli/tests/escrow.rs: the escrow protocol
LEMA_DURABLE_RUNTIMElema-cli/tests/durable.rs: durable actors
LEMA_PARALLEL_RUNTIMElema-cli/tests/parallel.rs: programs over disjoint handles
LEMA_TICKETS_RUNTIMElema-cli/tests/tickets.rs: tickets and spawned tasks
LEMA_CHANNELS_RUNTIMElema-cli/tests/channels.rs: session channels
LEMA_REPLACE_V2_RUNTIMElema-cli/tests/replace_v2.rs: checked replacement with a Core v2 claim
LEMA_REUSE_RUNTIMElema-cli/tests/reuse.rs: minimal parametric reuse
LEMA_RECEIVED_RUNTIMElema-cli/tests/received_families.rs: received families
LEMA_RECEIVED_STRUCTURES_RUNTIMElema-cli/tests/received_structures.rs: received structures, about 11 calls
LEMA_BUNDLE_RUNTIMElema-cli/tests/bundles.rs: bundles
LEMA_PROTECTED_RUNTIMElema-cli/tests/protected.rs: protected references, about 15 calls
LEMA_VIEW_RUNTIMElema-cli/tests/contract_view.rs: the contract view’s round tripLEMA_SCALE_HTTP_DRAFT
LEMA_STD_TEXT_RUNTIMElema-cli/tests/std_text.rs: Std.Text
LEMA_STD_MAP_RUNTIMElema-cli/tests/std_map.rs: Std.Map
LEMA_STD_JSON_RUNTIMElema-cli/tests/std_json.rs: Std.Json part 1
LEMA_STD_FIXED_RUNTIMElema-cli/tests/std_fixed.rs: fixed-point arithmetic
LEMA_STD_INTERVAL_RUNTIMElema-cli/tests/std_interval.rs: rescaling, square root, intervals
LEMA_STD_SHA256_RUNTIMElema-cli/tests/std_sha256.rs: the SHA-256 specification
LEMA_STD_BYTES_RUNTIMElema-cli/tests/std_bytes.rs: Std.Bytes
LEMA_STD_SHA256_IMPL_RUNTIMElema-cli/tests/std_sha256_impl.rs: Std.Sha256
LEMA_STD_HMAC_RUNTIMElema-cli/tests/std_hmac.rs: HMAC-SHA256
LEMA_STD_SIGV4_RUNTIMElema-cli/tests/std_sigv4.rs: AWS Signature Version 4
LEMA_JSON_RUNTIMElema-cli/tests/json.rs, then json_runs.rs: the JSON codecLEMA_JSON_STORE (for json_runs.rs)
LEMA_JSON_NUMBERS_RUNTIMElema-cli/tests/json_numbers.rs: JSON numbersLEMA_JSON_NUMBERS_STORE
LEMA_JSON_GRAMMAR_RUNTIMElema-cli/tests/json_grammar.rs: the JSON grammarLEMA_JSON_GRAMMAR_STORE
LEMA_JSON_CHECK_RUNTIMElema-cli/tests/json_check.rs: the JSON check program, about 9 callsLEMA_JSON_CHECK_STORE
LEMA_EXEC_RUNTIMElema-cli/tests/exec_manifest.rs: lema build, run and test in both backends, about 27 calls
LEMA_RELEASE_RUNTIMElema-cli/tests/release.rs: a release created, verified, selected, run and withdrawn, about 11 calls
LEMA_SITE_RUNTIMElema-cli/tests/site.rs: lema site build on real receipts, about 10 calls
LEMA_CAP_RUNTIMElema-cap/tests/native.rs: the capability platform, six callsLEMA_CAP_STATICLIB
LEMA_RUNNER_RUNTIMElema-cap/tests/runner.rs: the runner’s boundary suite, six callsLEMA_CAP_STATICLIB
LEMA_STANDALONE_RUNTIMElema-cli/tests/standalone.rs: a capability app built, tested, run and released, about 19 callsLEMA_CAP_STATICLIB
LEMA_SCALE_RUNTIMElema-cli/tests/scale.rs: one store accepting Core, a client and the migrated HTTP proofs, a restart, reverifyLEMA_SCALE_HTTP_DRAFT
LEMA_HTTP_RUNTIMElema-http/tests/native.rs: the HTTP artifact build and matrix modesLEMA_HTTP_STOREretired: HTTP v1
LEMA_LEAN_NATIVE_RUNTIMElema-http/tests/native_lean.rs: the lean-native backend on the HTTP artifactsLEMA_HTTP_STOREretired: HTTP v1
LEMA_HTTP_BYTES_RUNTIMElema-cli/tests/http_bytes.rs: the byte-array HTTP parserLEMA_SCALE_HTTP_DRAFTretired: HTTP v1
LEMA_REPLACE_RUNTIMElema-cli/tests/replace.rs: checked replacement of the HTTP v1 parserLEMA_SCALE_HTTP_DRAFTretired: HTTP v1
LEMA_HANDLE_DRIVER_RUNTIMElema-cli/tests/handle_driver.rs: the HTTP driver on handle contractsLEMA_SCALE_HTTP_DRAFTretired: HTTP v1
LEMA_INTERLEAVED_RUNTIMElema-cli/tests/interleaved.rs: interleaved HTTP connectionsLEMA_SCALE_HTTP_DRAFTretired: HTTP v1
LEMA_WEB_RUNTIMElema-cli/tests/web.rs: HTTP v2LEMA_SCALE_HTTP_DRAFTretired: HTTP v2 (lean/web)
LEMA_KEEP_RUNTIMElema-cli/tests/keep_alive.rs: keep-aliveLEMA_SCALE_HTTP_DRAFTretired: HTTP v2 (lean/web)
LEMA_KV_RUNTIMElema-cli/tests/kv.rs: the item store appLEMA_KV_STORE, LEMA_SCALE_HTTP_DRAFTretired: kv app
LEMA_LEDGER_RUNTIMElema-cli/tests/ledger.rs: the sharded ledgerLEMA_SCALE_HTTP_DRAFTretired: ledger app
LEMA_FANOUT_RUNTIMElema-cli/tests/fanout.rs: the fan-out appLEMA_SCALE_HTTP_DRAFTretired: fanout app
LEMA_HOST_RUNTIMElema-host/tests/: native.rs and replace.rs, web.rs, kv.rs, ledger_app.rs, fanout_app.rsLEMA_HTTP_STORE, LEMA_WEB_STORE, LEMA_KV_STORE, LEMA_LEDGER_STORE or LEMA_FANOUT_STORE; LEMA_HOST_BACKEND (lean-native or rust)retired: lema-host
LEMA_SCALING_RUNTIMElema-host/tests/scaling.rs: throughput and latency measurements, with no targetretired: lema-host
LEMA_BACKEND_RUNTIMElema-http/tests/backend_native.rs: one Rust execution artifactLEMA_BACKEND_STORE, LEMA_BACKEND_VARIANT (list, bytes, web or kv)on hold: Rust backend
LEMA_BACKEND_VECTORS_RUNTIMElema-cli/tests/backend_vectors.rs: runtime vectors published and replayedon hold: Rust backend
LEMA_BACKEND_JSON_RUNTIMElema-cli/tests/backend_vectors.rs: JSON and framing vectorsLEMA_BACKEND_JSON_STOREon hold: Rust backend
LEMA_BACKEND_BENCH_RUNTIMElema-host/tests/backend_measurements.rs: Lean and Rust artifacts measured in one session, with no targetLEMA_HTTP_STOREon hold: Rust backend

A *_STORE companion names a store a previous suite left, and LEMA_SCALE_HTTP_DRAFT names the migrated HTTP v1 draft. A few gated suites read variables that README.md does not list: LEMA_EVOLVE_RUNTIME (evolve.rs), LEMA_FUELED_RUNTIME (fueled_call_graph.rs), LEMA_REPLACE_GENERIC_RUNTIME (replace_generic.rs), LEMA_STD_CANONICAL_RUNTIME (std_canonical.rs), LEMA_STD_FINITE64_RUNTIME (std_finite64.rs), LEMA_STD_SHA256_UNBOXED_RUNTIME (std_sha256_unboxed.rs), LEMA_EXEC_SHA256_UNBOXED_RUNTIME (exec_sha256_unboxed.rs) and LEMA_CAP_PUBLISH_RUNTIME (cap_publish.rs), all under crates/lema-cli/tests/. Running the suites is covered in run the test suites.

Written against lema-lang at commit 5a94951, 17 Oct 2026.