Lunatic#
Lunatic is detected if both
- a
Cargo.tomlfile is found and .cargo/config.tomlhas therunner = "lunatic"
For example .cargo/config.toml:
[build] target = "wasm32-wasi" [target.wasm32-wasi] runner = "lunatic"
Environment Variables#
None
Setup#
By default the latest stable version of Rust available in this rust-overlay is used. The version can be overridden with either
- a
.rust-versionfile - The
rust-versionproperty ofCargo.toml - setting the
NIXPACKS_RUST_VERSIONenvironment variable - A
rust-toolchain.tomlfile
Install#
None
Build#
cargo build --release
Start#
The binaries get .wasm suffix and will be ran with the lunatic runtime.
If your project has multiple binaries, you can specify which one to run with the NIXPACKS_RUST_BIN environment variable. Optionally, it can be overriden with the default_run property in Cargo.toml under the [package] section.
./target/wasm32-wasi/release/{name}.wasm
Caching#
These directories are cached between builds
- Build:
~/.cargo/git - Build:
~/.cargo/registry - Build:
target
Workspaces#
Nixpacks will auto-detect if you are using Cargo Workspaces. This checks workspace.default_members first and then workspace.members. It also respects the workspace.exclude field.
To set which workspace Nixpacks will build, just set the NIXPACKS_CARGO_WORKSPACE environment variable and Nixpacks will use it as the --package argument.