{ 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 ]; }; } ); }; }