You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.6 KiB
1.6 KiB
| title | status | type | priority | created_at | updated_at |
|---|---|---|---|---|---|
| Nix flake for nbd | completed | task | low | 2026-03-10T23:30:30Z | 2026-03-10T23:30:30Z |
Add nbd/flake.nix so that nbd can be consumed as a Nix package and used as a CLI tool in other projects in the mono-repo.
Motivation
Other vibed services and external projects should be able to include nbd as a dev dependency via Nix, getting a pinned, reproducible binary without needing Cargo installed.
Approach
nbd/flake.nix
Follow the pattern from the repo root flake.nix. The service flake should:
- Inherit the base flake's inputs (nixpkgs, rust-overlay, etc.) or declare its own.
- Define a
packages.defaultattribute that builds thenbdcrate withrustPlatform.buildRustPackage. - Define a
devShells.defaultthat includes thenbdbinary and standard Rust tooling (rustfmt, clippy, cargo). - Optionally expose an
apps.defaultfornix run .#nbd.
Cargo.lock
Ensure Cargo.lock is committed (it already is) — required for reproducible Nix builds.
cargoHash / cargoSha256
The buildRustPackage derivation requires a cargoHash (or cargoSha256). Use the correct fetcher approach (vendored deps or fetchCargoTarball).
Steps
- Read the root
flake.nixto understand the base structure. - Write
nbd/flake.nixfollowing the same conventions. - Run
nix build .#nbdfrom thenbd/directory to verify it builds. - Run
nix run .#nbd -- --helpto verify the binary works.
Files touched
nbd/flake.nix— new fileREADME.md— addnix runusage section