Skip to main content

Development Setup

RepX development is fully Nix-based. All build, test, and documentation workflows are defined as flake outputs.

Prerequisites

RequirementVersionNotes
Nix2.4+Flakes and nix-command enabled

Enable experimental features in ~/.config/nix/nix.conf:

experimental-features = nix-command flakes

Flake Structure

Inspect available outputs:

nix flake show

Packages

OutputDescription
packages.repxThe RepX CLI binary
packages.repx-staticStatically linked binary (musl)
packages.repx-pyPython analysis library
packages.docsBuilt documentation site
packages.reference-labReference Lab for testing

Apps

OutputDescription
apps.defaultRun the RepX binary
apps.docs-previewBuild and serve documentation locally
apps.check-repx-examplesValidate example experiments

Development Shell

Enter the development environment:

nix develop

The shell provides all build dependencies without polluting the global environment.

Building

Build the CLI

nix build
# Output: ./result/bin/repx

Build Static Binary

nix build .#repx-static

Build Documentation

nix build .#docs

Build Python Package

nix build .#repx-py

Development Workflow

For iterative development, use the dev shell with cargo:

nix develop
cargo build --workspace
cargo test --workspace

Crate Structure

CratePurpose
repx-cliCommand-line interface
repx-runnerJob scheduling and submission
repx-coreShared types, configuration, logging
repx-executorRuntime abstraction and process execution
repx-clientTarget backends (local, SSH, SLURM)
repx-tuiTerminal user interface
repx-vizTopology visualization
repx-test-utilsTest harness and fixtures

Documentation

Preview documentation locally:

nix run .#docs-preview

This builds the documentation and serves it at http://localhost:8080/.

Code Quality

All linting is available as flake checks:

# Run all checks
nix flake check

# Run specific lint check
nix build .#checks.x86_64-linux.clippy
nix build .#checks.x86_64-linux.formatting
nix build .#checks.x86_64-linux.machete

Available Lint Checks

CheckDescription
clippyRust linter
formattingCode formatting validation
macheteUnused dependency detection
deadnixDead Nix code detection
statixNix static analysis
shellcheckShell script linting
shebangShebang line validation

Format Code

nix fmt

Environment Variables

VariablePurpose
REFERENCE_LAB_PATHPath to reference Lab (set automatically in checks)
REPX_LOG_LEVELLog verbosity: error, warn, info, debug, trace

IDE Configuration

rust-analyzer

The workspace is configured for rust-analyzer. Ensure your editor loads the workspace Cargo.toml.

Enter the dev shell before starting your editor to ensure tooling is available:

nix develop
code .

Direnv Integration

For automatic shell activation, create .envrc:

use flake

Then run direnv allow.