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.
38 lines
1.5 KiB
Markdown
38 lines
1.5 KiB
Markdown
+++
|
|
title = "Nix flake for nbd"
|
|
priority = 4
|
|
status = "done"
|
|
ticket_type = "task"
|
|
dependencies = []
|
|
+++
|
|
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:
|
|
1. Inherit the base flake's inputs (nixpkgs, rust-overlay, etc.) or declare its own.
|
|
2. Define a `packages.default` attribute that builds the `nbd` crate with `rustPlatform.buildRustPackage`.
|
|
3. Define a `devShells.default` that includes the `nbd` binary and standard Rust tooling (rustfmt, clippy, cargo).
|
|
4. Optionally expose an `apps.default` for `nix 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
|
|
1. Read the root `flake.nix` to understand the base structure.
|
|
2. Write `nbd/flake.nix` following the same conventions.
|
|
3. Run `nix build .#nbd` from the `nbd/` directory to verify it builds.
|
|
4. Run `nix run .#nbd -- --help` to verify the binary works.
|
|
|
|
## Files touched
|
|
- `nbd/flake.nix` — new file
|
|
- `README.md` — add `nix run` usage section |