Nix templates
The Nix flake template NativeLink ships — Local Remote Execution with Bazel in one flake init command.
NativeLink ships a Nix flake template that wires a Bazel project to Local Remote Execution in one command. Useful for experimenting with LRE, demoing the system, or debugging a regression on a known-good baseline.
Prerequisites
- Nix with flakes enabled. The next-gen installer is the easiest path.
- About 5 GB of disk space for the toolchain on first run.
Available templates
nix flake show github:TraceMachina/nativelinkThis command is the source of truth
Templates get added and removed between releases. Run the command above rather than trusting a hardcoded list — including the one below, which only reflects what's shipping as of this page's last update.
| Template | What it gives you |
|---|---|
bazel | A Bazel cc_binary project pre-wired for Local Remote Execution: Nix-pinned toolchain, LRE Bazel module, and a user.bazelrc you point at a cache and executor. |
The Bazel template
mkdir my-rbe-test && cd my-rbe-test
nix flake init -t github:TraceMachina/nativelink#bazel
nix developnix develop downloads the Nix-pinned toolchain and generates
lre.bazelrc, which the template's .bazelrc already try-imports.
It does not bundle a NativeLink server — you point it at one you
already have:
# In user.bazelrc
build --remote_cache=grpcs://TODO
build --bes_backend=grpcs://TODO
build --remote_timeout=600
build --remote_executor=grpcs://TODOThree ways to fill in TODO — Local Remote Execution → Point
user.bazelrc at a real cache and executor
has a worked, filled-in example of the file below, whichever option
you pick:
- dev.nativelink.com — paste your
cloud credentials, use
grpcs://. - A self-hosted cluster — your own endpoint,
grpcs://if it terminates TLS. - Nothing but your own machine — drop the
s, point bothremote_cacheandremote_executoratgrpc://127.0.0.1:50051. Local cache and executor gets you a from-scratch, credential-free instance in one command — enough to validateremote_cache, though the included C++ example'slre-ccplatform still needs a worker running the matching container image to actually execute (see Local Remote Execution for what that involves).
Then build the included example:
bazel build hello-worldRe-run; the cached actions should skip straight to a cache hit.
Not shipped as flake templates today
Earlier drafts of this page also described cargo, lre, and
kubernetes templates. None exist in flake.nix right now — running
nix flake init -t github:TraceMachina/nativelink#lre (or #cargo,
#kubernetes) fails with does not provide attribute 'templates.X'.
If you followed a link here looking for one of those:
- A local Bazel cluster with no Nix at all — Local cache and
executor starts CAS, AC, a scheduler, and a
worker in one
nativelinkprocess. - A real Kubernetes deployment — Deployment → Kubernetes
covers the Helm chart directly;
kind+ that chart gets you the same result akubernetestemplate would have. - Cargo / sccache — not currently packaged as a template; the
bazeltemplate above is the maintained path.
Customising
The template is a flake — fork and edit. The most common modifications:
- Point
user.bazelrcat your real cluster instead of a throwaway one. - Add custom worker platform properties in
platforms/BUILD.bazel. - Pin to a specific NativeLink commit (
inputs.nativelink.urlinflake.nix, kept in sync with thelocal-remote-executionmodule override inMODULE.bazel).
What's next
- Local Remote Execution — this same template, walked through step by step and tested for real.
- Local cache and executor — the fastest way to
get something running on
127.0.0.1to point this template at. - Explanations → LRE — what the toolchain pinning this template sets up actually buys you.
- Architecture — the data flow this template exercises.
- Configuration → Basic — the JSON5 shape a server you point this at should speak.