Nyzhi is written in Rust. You can build it from source on macOS, Linux, and (with some effort) Windows.
Prerequisites
- Rust stable (1.75 or newer) with
rustfmtandclippy - Git for cloning the repository
The exact Rust version is pinned in rust-toolchain.toml, so rustup will install the right one automatically.
Quick Build
# Clone the repository
git clone https://github.com/nyzhi-com/code
cd code
# Build in release mode
cargo build --release -p nyzhi
# Verify it works
./target/release/nyz --version
The binary is at target/release/nyz.
Install Globally
After building, copy the binary to your PATH:
# Option 1: Copy manually
cp target/release/nyz /usr/local/bin/
# Option 2: Use cargo install
cargo install --path crates/cli
Development Build
For faster iteration during development:
# Debug build (faster compile, slower runtime)
cargo build
# Run directly
cargo run -p nyzhi -- --version
# Run the TUI
cargo run -p nyzhi
Quality Checks
Run the same checks as CI before submitting changes:
# Format check
cargo fmt --all --check
# Lint check
cargo clippy --workspace --all-targets -- -D warnings
# Tests
cargo test --workspace
Quick type-check (no codegen):
cargo check --workspace
Workspace Structure
The Nyzhi workspace contains seven crates:
| Crate | Path | What it does |
|---|---|---|
nyzhi (CLI) | crates/cli | Binary entrypoint |
nyzhi-tui | crates/tui | Terminal UI |
nyzhi-core | crates/core | Agent runtime, tools, sessions |
nyzhi-provider | crates/provider | LLM provider abstraction |
nyzhi-auth | crates/auth | Credential management |
nyzhi-config | crates/config | Configuration schema |
nyzhi-index | crates/index | Semantic code index |
Build a specific crate:
cargo build --release -p nyzhi-core
cargo test -p nyzhi-provider
Cross-Compilation
The release pipeline builds for four targets:
| Target | Platform |
|---|---|
x86_64-unknown-linux-gnu | Linux x86_64 |
aarch64-unknown-linux-gnu | Linux ARM64 |
x86_64-apple-darwin | macOS Intel |
aarch64-apple-darwin | macOS Apple Silicon |
Cross-compiling for Linux ARM64
Requires a cross-linker:
# Install cross-linker (Ubuntu/Debian)
sudo apt install gcc-aarch64-linux-gnu
# Build
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
cargo build --release --target aarch64-unknown-linux-gnu -p nyzhi
Cross-compiling macOS targets
On Apple Silicon, build for Intel:
rustup target add x86_64-apple-darwin
cargo build --release --target x86_64-apple-darwin -p nyzhi
CI Reference
CI runs on every push to master:
cargo fmt --all --checkcargo clippy --workspace --all-targets(withRUSTFLAGS=-Dwarnings)cargo test --workspace
Troubleshooting
“rustfmt not found” — Install it with:
rustup component add rustfmt
“clippy not found” — Install it with:
rustup component add clippy
Build fails on Linux — Make sure you have the standard build tools:
sudo apt install build-essential pkg-config libssl-dev
Next Steps
- Releasing — the release pipeline
- Architecture — how the crates fit together
- Verification — running quality checks