Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Reproducible Development with Nix

Warning

This is an advanced topic for users familiar with Nix. If you're new to Nix, you can safely skip this chapter and use the standard Building instructions instead.

ros-z provides Nix flakes for reproducible development environments with all dependencies pre-configured.

Why Use Nix?

Reproducible Builds: Nix ensures every developer and CI system uses the exact same dependencies, eliminating "works on my machine" issues. All dependencies—from compilers to ROS 2 packages—are pinned to specific versions and cached immutably.

Uniform CI/CD: The same Nix configuration that runs locally is used in continuous integration, ensuring build consistency across development, testing, and deployment environments. No more divergence between local builds and CI failures.

Zero Setup: New team members can start developing with a single nix develop command—no manual ROS installation, no dependency hunting, no environment configuration.

Available Environments

# Default: ROS 2 Jazzy with full tooling
nix develop

# Specific ROS distros
nix develop .#ros-jazzy      # ROS 2 Jazzy
nix develop .#ros-rolling    # ROS 2 Rolling

# Pure Rust (no ROS)
nix develop .#pureRust       # Minimal Rust toolchain only

Use Cases

Use CaseEnvironmentBenefit
Team DevelopmentAll developersEveryone has identical toolchains and dependencies
CI/CD PipelinesGitHub Actions, GitLab CISame environment locally and in automation
Cross-PlatformLinux, macOS, WSLConsistent builds regardless of host OS
Multiple ROS VersionsSwitch environments easilyTest against different ROS distros without conflicts

Tip

Use Nix for consistent development environments across team members and CI/CD pipelines. The reproducibility guarantees catch integration issues early.

Learning More