feat(nbd): add Nix flake for building and running nbd [6e4239]
Add flake.nix so nbd can be consumed as a reproducible Nix package. Exposes packages.default, apps.default (nix run), and a devShell with stable Rust toolchain and the nbd binary. Uses cargoLock for dependency hashing without a pre-computed cargoHash. Also adds an Installation section to README.md covering nix run and nix build usage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>quotesdb
parent
7aa547633f
commit
ffbb0157e3
@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
description = "nbd — CLI tool for managing work tickets, targeted at agent workflows";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
rust-overlay = {
|
||||||
|
url = "github:oxalica/rust-overlay";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
rust-overlay,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
forAllSystems =
|
||||||
|
f:
|
||||||
|
nixpkgs.lib.genAttrs systems (
|
||||||
|
system:
|
||||||
|
f {
|
||||||
|
inherit system;
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [ rust-overlay.overlays.default ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = forAllSystems (
|
||||||
|
{ pkgs, system }:
|
||||||
|
{
|
||||||
|
# The nbd CLI package, built with rustPlatform.buildRustPackage.
|
||||||
|
nbd = pkgs.rustPlatform.buildRustPackage {
|
||||||
|
pname = "nbd";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
cargoLock = {
|
||||||
|
lockFile = ./Cargo.lock;
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "CLI tool for managing work tickets, targeted at agent workflows";
|
||||||
|
license = with pkgs.lib.licenses; [
|
||||||
|
asl20
|
||||||
|
mit
|
||||||
|
];
|
||||||
|
mainProgram = "nbd";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Make nbd the default package so `nix build` works without specifying an attribute.
|
||||||
|
default = self.packages.${system}.nbd;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
apps = forAllSystems (
|
||||||
|
{ system, ... }:
|
||||||
|
{
|
||||||
|
# Run nbd directly with `nix run .#nbd`.
|
||||||
|
nbd = {
|
||||||
|
type = "app";
|
||||||
|
program = "${self.packages.${system}.nbd}/bin/nbd";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Make nbd the default app so `nix run` works without specifying an attribute.
|
||||||
|
default = self.apps.${system}.nbd;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
devShells = forAllSystems (
|
||||||
|
{ pkgs, system }:
|
||||||
|
{
|
||||||
|
# Development shell with stable Rust toolchain and nbd binary.
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
# Stable Rust toolchain: compiler, cargo, rustfmt, clippy.
|
||||||
|
pkgs.rust-bin.stable.latest.default
|
||||||
|
# The built nbd binary, available as `nbd` in the shell.
|
||||||
|
self.packages.${system}.nbd
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue