Skip to main content

Build Methods

Loom supports two build methods:
  1. Nix with cargo2nix (Preferred) - Reproducible builds with per-crate caching
  2. Cargo (Development) - Standard Rust toolchain builds
Nix builds are significantly faster on incremental changes due to per-crate caching. Use Cargo for quick iteration during development.

Nix Build (Preferred)

Prerequisites

1

Install Nix

Install Nix with flakes enabled:
2

Enable Flakes

Flakes should be enabled by default with the Determinate Systems installer. Verify:

Building Loom

Loom uses cargo2nix for reproducible builds with per-crate caching:

cargo2nix Workflow

When you modify Cargo.toml or Cargo.lock:
1

Update Cargo.lock

2

Regenerate Cargo.nix

This regenerates Cargo.nix with the updated dependency graph.
3

Commit Both Files

cargo2nix doesn’t track include_str! file changes. If you add/modify migration files or other embedded resources, run cargo2nix-update to force a rebuild by changing the hash.

Cargo Build (Development)

Prerequisites

1

Install Rust

Install Rust using rustup:
2

Verify Installation

Building with Cargo

Full Check

Run all quality checks:
This runs:
  1. cargo fmt --all -- --check - Format verification
  2. cargo clippy --workspace -- -D warnings - Linting
  3. cargo build --workspace - Build
  4. cargo test --workspace - Tests

Build Profiles

Loom uses optimized build profiles:

Development Profile

Cargo.toml

Fast Profile

For git hooks and quick iteration:
Cargo.toml

Release Profile

Cargo.toml
Loom’s release profile prioritizes fast compilation over runtime performance since deployment uses Nix builds.

Installation Locations

System-wide Installation

Add to your ~/.config/nixpkgs/config.nix or NixOS configuration:

Development Installation

For development, use the binary directly:

Web Frontend

The web UI is built with SvelteKit:
1

Install pnpm

2

Install Dependencies

3

Run Development Server

Open http://localhost:5173
4

Build for Production

Server Deployment

Loom server runs on NixOS with auto-update:

NixOS Auto-Update

Deployments happen automatically on git push to trunk:
The production server:
  1. Checks for new commits every 10 seconds
  2. Rebuilds using Nix when changes detected
  3. Restarts the loom-server systemd service

Verify Deployment

1

Check Deployed Revision

2

Check Service Status

3

View Update Logs

4

Verify Health Endpoint

Force Rebuild

If auto-update is stuck:

Database Migrations

All migrations live in crates/loom-server/migrations/:

Adding Migrations

1

Create Migration File

2

Write SQL

crates/loom-server/migrations/025_new_feature.sql
3

Force Rebuild

Critical: cargo2nix doesn’t track include_str! changes. You must regenerate Cargo.nix:
Without this, the deployed binary won’t include the new migration!

Migration Testing

Test migrations locally:
Migrations run automatically on server startup.

Troubleshooting

Nix Build Fails

Cargo Build Fails

cargo2nix Out of Sync

If Nix build fails with dependency errors:

Next Steps

Quick Start

Start your first REPL session

Configuration

Configure Loom for your environment

Development Guide

Learn about code style, testing, and contributing

Deployment

Deploy Loom server to production