Prerequisites
- Bazel 6.0 or later
- A running NativeLink instance (see Quickstart)
- For LRE: Nix 2.19.0 or later with flakes enabled
Basic Remote Cache Configuration
To use NativeLink as a remote cache, add the following flags to your.bazelrc:
.bazelrc
Remote Execution Configuration
For remote execution, configure both the cache and executor endpoints:.bazelrc
Local Remote Execution (LRE)
LRE provides hermetic, reproducible toolchains that work identically in local and remote execution environments.Flake-side Setup
Bazel-side Setup
Generated Configuration
When you enter the Nix environment,lre.bazelrc is generated with LRE toolchain paths:
lre.bazelrc
Complete Configuration Example
Here’s a complete.bazelrc based on NativeLink’s own configuration:
Authentication
For production deployments with authentication:- mTLS
- API Key
Configure mutual TLS authentication:
.bazelrc
Testing Your Configuration
Common Flags
| Flag | Description |
|---|---|
--remote_cache | Remote cache endpoint (grpc:// or grpcs://) |
--remote_executor | Remote execution endpoint |
--remote_instance_name | Instance name for multi-tenant setups |
--remote_default_exec_properties | Default execution properties (cpu_count, memory, etc.) |
--digest_function | Hash function (blake3 recommended) |
--incompatible_strict_action_env | Prevent PATH/LD_LIBRARY_PATH leakage |
--platform_suffix | Suffix for platform names |
Troubleshooting
Cache misses between local and remote
Ensure toolchain paths match between local and remote execution. With LRE, verify the/nix/store/... paths in lre.bazelrc match the worker container.