{ description = "boxmaker: a sovereign personal agent harness"; inputs = { nixpkgs.url = "nixpkgs/nixos-26.05"; # The Rust toolchain, pinned below, independent of the host's nixpkgs release. rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, rust-overlay, }: let systems = [ "x86_64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs systems; # nixpkgs with rust-overlay, and the one Rust toolchain every host uses (the workspace's # `rust-version`): cargo, rustc, clippy and rustfmt. pkgsFor = system: import nixpkgs { inherit system; overlays = [ rust-overlay.overlays.default ]; }; toolchainFor = pkgs: pkgs.rust-bin.stable."1.98.1".default.override { extensions = [ "clippy" "rustfmt" ]; }; version = if self ? shortRev then self.shortRev else if self ? dirtyShortRev then self.dirtyShortRev else "dev"; in { packages = forAllSystems ( system: let pkgs = pkgsFor system; toolchain = toolchainFor pkgs; rustPlatform = pkgs.makeRustPlatform { cargo = toolchain; rustc = toolchain; }; lib = pkgs.lib; # Only what the build reads: no target/, no .state/, no docs. src = lib.cleanSourceWith { src = ./.; filter = path: type: let rel = lib.removePrefix (toString ./. + "/") (toString path); in rel == "Cargo.toml" || rel == "Cargo.lock" || rel == "crates" || lib.hasPrefix "crates/" rel; }; # Every binary of the workspace: the roles, bxctl and toolkit. boxmaker = rustPlatform.buildRustPackage { pname = "boxmaker"; inherit version src; cargoLock.lockFile = ./Cargo.lock; # The tests run in `make gate`: they need Unix sockets under /tmp and scripts they write # and run, which the build sandbox is not checked to allow. doCheck = false; meta = { description = "a sovereign personal agent harness"; mainProgram = "bxctl"; }; }; # The image every tool container runs from; see the file for how it is loaded. tools-image = import ./deploy/tools-image.nix { inherit pkgs; }; in { inherit boxmaker tools-image; default = boxmaker; } ); devShells = forAllSystems ( system: let pkgs = pkgsFor system; in { default = pkgs.mkShell { nativeBuildInputs = [ (toolchainFor pkgs) pkgs.cargo-deny pkgs.gnumake ]; }; } ); }; }