- Rust 73.4%
- Python 20.2%
- Nix 6.4%
Proxy multiple upstream caches and record download observations in Turso, with offline JSON reports, Prometheus metrics, and asynchronous event hooks. Add metadata admission policies and extensible sandboxed archive review with a Bubblewrap worker adapter. Include Nix packaging, a NixOS module, integration tests, examples, and deployment documentation. |
||
|---|---|---|
| docs | ||
| examples | ||
| nix | ||
| src | ||
| tests | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
Narbor
A Nix binary-cache proxy for observing downloads and applying admission policies. Route multiple caches through one service, record artifact observations and transfer counts, and optionally hold archives for review before delivering them.
Status: early prototype. The CLI provides proxying, reports, metrics and a metadata command policy. Sandboxed archive review is a Rust extension point: Bubblewrap support is implemented, but you must supply and register a reviewer. No package scanner or LLM reviewer is included.
What it does
| Capability | Available through |
|---|---|
| Proxy multiple upstream caches with separate origin allowlists | CLI and NixOS module |
| Record metadata observations, transfers and first-seen events | Embedded Turso database and JSON reports |
| Expose live counters and asynchronous event hooks | Prometheus listener and Rust handler API |
| Allow or deny downloads using metadata | Command adapter or DownloadPolicy trait |
| Download and review archives inside a sandbox | ArchiveWorker, Bubblewrap adapter and your ArchiveReviewer |
| Use another worker backend, such as a microVM | Your implementation of ArchiveWorker |
Ordinary archive requests stream through the proxy. With sandboxed review registered, the flow is:
Client request → proxy → sandbox worker downloads and reviews
↓ approval + archive
Client response ← proxy verifies and serves a private copy
The proxy does not fetch the archive before invoking the worker or download it again after approval. See admission and review for the trait boundaries, artifact handoff and failure behavior.
Quick start
On Linux, enter the pinned Nix development environment and run the proxy:
nix develop
cargo run --locked -- serve --config examples/config.toml
In another terminal, direct a Nix substitution through the local proxy:
nix build nixpkgs#hello --option substituters http://127.0.0.1:8080
Keep the upstream cache's trusted public keys and signature verification enabled.
An already present store path needs no download and will produce no observation.
The default example uses https://cache.nixos.org, listens on loopback port 8080,
and writes observations.db in the current directory.
Without Nix, native build requirements are Rust/Cargo with edition-2024 support,
C/C++, pkg-config, OpenSSL, CMake and libclang. Python 3 is needed for the
integration tests. Build with cargo build --locked; the flake pins the tested
toolchain and native dependencies. The supported flake platforms are
x86_64-linux and aarch64-linux.
Configuration and extension guides
- Nix development and NixOS deployment
- Multiple caches, routing, observations, reports and event delivery
- Prometheus metrics and accounting
- Metadata admission and sandboxed archive review
- Validation record and optional integration checks
Start with single-cache configuration or multiple-cache configuration. Rust extension examples show a metadata policy and a sandbox worker with a reviewer placeholder.
Current boundaries
- Observations describe metadata requests and downloads, not installation or execution. The proxy does not verify packages in place of Nix.
- There is no client authentication or downstream TLS. Use a trusted network or an authenticated TLS frontend. Direct upstream access can bypass admission.
- Bubblewrap isolates filesystems and processes but shares host networking. Reviewer code needs separate network confinement if that is required.
- Sandbox requests currently download and review each time. There is no persistent archive cache, durable review queue or built-in reviewer.
- Reports require the service to be stopped. Transfer accounting can lose in-flight data on a crash. Database retention is not implemented.
Development
nix develop
cargo fmt --all -- --check
cargo clippy --all-targets --all-features --locked -- -D warnings
cargo test --all-targets --locked
The flake also defines package, formatting, lint, module and VM checks. Bubblewrap tests require unprivileged Linux namespaces; see the validation guide for the explicit command and tested scope.
License
MIT.