Documentation

Building from Source

Clone, build, and run Nyzhi from source — prerequisites, workspace commands, and cross-compilation.

Edit on GitHub

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 rustfmt and clippy
  • 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:

CratePathWhat it does
nyzhi (CLI)crates/cliBinary entrypoint
nyzhi-tuicrates/tuiTerminal UI
nyzhi-corecrates/coreAgent runtime, tools, sessions
nyzhi-providercrates/providerLLM provider abstraction
nyzhi-authcrates/authCredential management
nyzhi-configcrates/configConfiguration schema
nyzhi-indexcrates/indexSemantic 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:

TargetPlatform
x86_64-unknown-linux-gnuLinux x86_64
aarch64-unknown-linux-gnuLinux ARM64
x86_64-apple-darwinmacOS Intel
aarch64-apple-darwinmacOS 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:

  1. cargo fmt --all --check
  2. cargo clippy --workspace --all-targets (with RUSTFLAGS=-Dwarnings)
  3. 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