buf-purifier full guide
Detailed setup, dependency management, build commands, and troubleshooting. Start with the overview for the initial commands; use the sections below for the complete setup and behavior. buf-purifier is classified at maturity tier 4 (see tier assessment for details).
Contents
- Setup and activation
- Version compatibility
- Development loop
- Using locked dependencies
- Language tooling integration
- Nix builds
- Project projections
- Supported scope
Setup and activation
Use the overview’s Quickstart for the initial command sequence. The setup details below apply to that workflow.
Buf’s native resolver writes buf.lock. Nix supplies its digest-checked modules
through a private cache whose module sources are readonly. Your workspace remains
mutable, and source edits do not require relocking.
Commit buf.lock and buf-purifier.lock.json. After changing dependency selection:
buf-purifier lock --update
The wrapper warns and uses ordinary, impure Buf when there is no purifier lock. Invalid or stale locks fail. Install the integration through your normal Nix configuration if you want it available beyond the temporary shell.
Version compatibility
| Tool or language | Packaged defaults | Tested versions |
|---|---|---|
| Buf | 1.73.0 | — |
Operating systems and architectures
| OS | CPU architecture | Packaged toolchain | Recorded workflow |
|---|---|---|---|
| Linux | ARM64 | Yes | Not recorded |
| Linux | x86-64 | Yes | Tested |
Development loop
buf format -w
buf-purifier exec -- your-editor
buf-purifier prefetch
Using locked dependencies
--input path tracks extra selection files. Use --project and --lock for an
external companion; wrappers accept BUF_PURIFIER_PROJECT and
BUF_PURIFIER_LOCK. Prepared sessions retain their dependency and SDK closures
for garbage collection.
Language tooling integration
Buf’s language server uses the same locked modules. Dependency cache misses fail
before registry fetching; ordinary root commands retain their network access.
Private writable lock files and tool caches use XDG_CACHE_HOME.
The working tree’s .buf-purifier retains the prepared SDK profile.
Nix builds
The overlay provides a named builder:
pkgs.buf-purifier.buildBufProject {
src = ./.;
}
It exposes evaluation-known packages, tests, release and fetches. The
project output includes the native descriptor image and generated sources.
Project projections
This integration provides native release artifacts, rather than a typed cross-purifier project projection interface. The publication workflow below uses those native artifacts.
buf-purifier bundle
buf-purifier publish --tag v0.1.0
The reproducible source archive contains native Buf configuration and schemas. Ordinary Buf can consume it. Publication uploads the exact realized archive to an existing GitHub release.
Supported scope
The initial integration supports v2 workspaces, public BSR modules with b5 digests, and
protoc_builtin generators supplied by the Nix Protobuf compiler. Remote and
external plugins need additional Nix tool providers. Generated output stays in
your normal working-tree directories.
Target systems
- x86_64-linux
- aarch64-linux