Build with Nix Env
Nix provides a reproducible development environment with consistent dependencies across machines.
Installing Nix
The multi-user (daemon) install is recommended — it supports concurrent builds and better isolation. The single-user option is simpler but skips the background daemon.
# 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
Flakes are Nix's modern approach to reproducible project definitions. Enable them by adding this line 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
If you'd rather not install Nix on your host, use the official Nix Docker image. This mounts your local repo into the container.
docker run -it --rm -v $(pwd):/workspace -w /workspace nixos/nix bash
Inside the container, enter the dev shell.
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.