Develop with Nix
The official dev shell — hermetic by construction, identical to what CI runs.
The NativeLink flake provisions a complete dev shell — the exact Rust
toolchain, the exact Bazel version, protoc, mold, every binary
the build invokes. Use this if you want absolute reproducibility, or
if you're working on LRE (which requires
Nix).
Install Nix
The next-gen Nix installer is the easiest path:
curl --proto '=https' --tlsv1.2 -sSf \
-L https://install.determinate.systems/nix | sh -s -- installIt enables flakes by default.
macOS / Linux Nix Setup Gotchas
- Environment Paths: If your shell doesn't recognize
nixcommands immediately after installation, you need to restart your terminal or run:. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - Experimental Features: If you used the standard Nix installer and get
experimental Nix feature 'nix-command' is disabled, enable them by adding the following to your~/.config/nix/nix.conffile:experimental-features = nix-command flakes - Disk Space: Unpacking toolchains, compiler binaries, and caching build artifacts requires considerable storage. Ensure you have at least 15–20 GB of free space on your drive before running
nix develop.
Enter the dev shell
git clone https://github.com/TraceMachina/nativelink
cd nativelink
nix developFirst run downloads the toolchain (a few minutes). Subsequent
nix develop invocations are instant — everything is content-
addressed in /nix/store.
Inside the shell you have:
- Cargo + the pinned Rust toolchain.
- Bazel + Bazelisk.
protoc,mold,clang, and friends.- Test runners and linters (
cargo-nextest,cargo-deny,cargo-shear). - The
nativelinkbinary itself, prebuilt.
Running things inside the shell
Anything from the Bazel or
Cargo workflow works inside nix develop.
The shell just guarantees the tooling is the version we tested.
LRE-specific helpers
The flake exposes a few LRE-flavoured entry points:
# Start an LRE-configured NativeLink server.
nix run .#nativelink-lre
# Open a shell with the LRE toolchain pinned.
nix develop .#lreSee Explanations → LRE for what these are doing.
When Nix isn't worth it
If you're making a small, localised change — typo fix, doc tweak, a unit test — the Cargo workflow is faster to get into. Nix shines for work touching the build graph, the LRE flow, or anything that needs exact toolchain reproducibility.