Nix templates
Reproducible NativeLink testbeds in a single flake init command.
NativeLink ships Nix flake templates that spin up a complete remote-execution environment in one command. Useful for experimenting with configuration changes, 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/nativelinkThe templates we ship and maintain:
| Template | What it gives you |
|---|---|
bazel | Bazel monorepo wired to a local NativeLink cluster. |
cargo | Pure Cargo project with sccache pointing at NativeLink. |
lre | Local Remote Execution — hermetic builds, no network. |
kubernetes | kind cluster running the NativeLink Helm chart. |
The Bazel template
The fastest path to a working RBE setup:
mkdir my-rbe-test && cd my-rbe-test
nix flake init -t github:TraceMachina/nativelink#bazel
nix developInside the dev shell you have:
- A pinned Bazel + Bazelisk.
- A NativeLink server binary.
- A
.bazelrc.localalready pointed atlocalhost:50051.
Start the NativeLink server in one terminal:
nativelink ./config/nativelink.json5Build the included sample target in another:
bazel build //helloRe-run; everything should hit the cache.
The LRE template
mkdir my-lre-test && cd my-lre-test
nix flake init -t github:TraceMachina/nativelink#lre
nix developThe dev shell provides a fully-hermetic Nix-pinned toolchain.
NativeLink runs on localhost; Bazel is pre-configured to use it.
nativelink ./config/lre.json5
bazel build //helloThe first build of any target is the cost of compilation. Every
subsequent build is the cost of one network round-trip to
localhost.
The Kubernetes template
For prototyping a real deployment without leaving your laptop:
mkdir my-k8s-test && cd my-k8s-test
nix flake init -t github:TraceMachina/nativelink#kubernetes
nix developThe flake includes kind, kubectl, helm, and the NativeLink
chart. Bring up a local cluster:
kind create cluster
helm install nativelink ./chart
kubectl wait --for=condition=Ready pods --allYou now have CAS + scheduler + workers running in a local cluster
on your laptop. Port-forward :50051 and point Bazel at it.
Customising
Every template is a flake — fork and edit. The most common modifications:
- Swap the
nativelink.json5for a config matching your real environment. - Add custom worker platform properties.
- Pin to a specific NativeLink release (
inputs.nativelink.url).
What's next
- Architecture — the data flow these templates exercise.
- Configuration → Basic — the JSON5 the templates ship.