Build with Nix Env

Nix provides a reproducible development environment with consistent dependencies across machines.

Installing Nix

# Multi-user installation (recommended for Linux/macOS)
sh <(curl -L https://nixos.org/nix/install) --daemon

# Single-user installation
sh <(curl -L https://nixos.org/nix/install) --no-daemon

See the official Nix installation guide for details.

Setup with Nix Flakes

Enable Flakes

Add to ~/.config/nix/nix.conf (or /etc/nix/nix.conf):

experimental-features = nix-command flakes

Enter Development Shell

cd noir
nix develop

This sets up Crystal, shards, and all dependencies automatically.

Alternative: Using Docker with Nix

docker run -it --rm -v $(pwd):/workspace -w /workspace nixos/nix bash

Inside the container:

nix develop

Updating Dependencies

After modifying shard.yml, regenerate shards.nix to keep Nix in sync:

nix-shell -p crystal2nix --run crystal2nix

Benefits

  • Reproducibility: Same environment across all machines
  • Isolation: No interference with system-wide dependencies
  • Consistency: All team members use the same tool versions
  • Easy Setup: Single command to get started

Next Steps

Proceed with the standard build and test procedures.

Esc