56 lines
2.7 KiB
Nix
56 lines
2.7 KiB
Nix
# Shared crane wiring for the rust workspace: the cargo source
|
|
# filter, the once-built dependency artifacts, and the native build
|
|
# inputs every rust derivation (packages + checks) consumes.
|
|
# Imported per system from flake.nix.
|
|
{ pkgs, craneLib }:
|
|
rec {
|
|
# Shared between buildDepsOnly + buildPackage + cargoClippy/cargoTest
|
|
# so every derivation in the chain sees the same toolchain shape.
|
|
# git: hive-c0re's `lifecycle::tests::setup_proposed_*` shell out to
|
|
# `git init` + commit under `cargo test` in the sandbox.
|
|
# sqlite: matrix-sdk's `sqlite` feature (`hive-matrix-mcp` workspace
|
|
# member) — the matrix-sdk-sqlite + rusqlite stack links against
|
|
# system libsqlite3 by default.
|
|
# cmake: builds `aws-lc-sys` (BoringSSL) from source — pulled in by
|
|
# the `rustls` (aws-lc-rs) crypto provider under the OTLP/reqwest
|
|
# stack in `hive-metric`.
|
|
nativeBuildInputs = [
|
|
pkgs.git
|
|
pkgs.sqlite
|
|
pkgs.pkg-config
|
|
pkgs.cmake
|
|
];
|
|
|
|
# Narrowed source tree the rust derivations consume.
|
|
# `cleanCargoSource` is crane's standard "everything cargo cares
|
|
# about" filter (Cargo.toml/Cargo.lock + *.rs). All non-rust runtime
|
|
# assets — branding + the claude system prompt template +
|
|
# claude-settings.json — live in the separate `hyperhive-assets`
|
|
# derivation and are loaded by the binaries at runtime from
|
|
# `$HIVE_ASSETS_DIR`. The unit tests in `hive-ag3nt::prompt` read
|
|
# `prompts/system.md` directly from the workspace tree at *test*
|
|
# runtime (via `env!("CARGO_MANIFEST_DIR")` — a compile-time string,
|
|
# no file open at compile), so the prompt template doesn't have to
|
|
# be in this fileset to keep `cargo test` honest. Net effect: tweaks
|
|
# to any non-`*.rs` / non-`Cargo.*` file (README, branding, nix
|
|
# modules, frontend tree, OR `hive-ag3nt/prompts/*`) do NOT bust
|
|
# this src hash, so the rust derivations stay fully cached.
|
|
cleanSrc = craneLib.cleanCargoSource ../.;
|
|
|
|
# Build the workspace's dependency tree once, cached as its own
|
|
# derivation. Package builds and checks reuse this via
|
|
# `inherit cargoArtifacts;` so a workspace-only edit doesn't rebuild
|
|
# deps. All consumers use the same `cleanSrc` so the input hash
|
|
# stays consistent across the chain.
|
|
cargoArtifacts = craneLib.buildDepsOnly {
|
|
src = cleanSrc;
|
|
# Workspace Cargo.toml is virtual (no `[package].name`), so crane
|
|
# can't auto-derive a name. Spell it out explicitly — keeps the
|
|
# derivation name stable across crane bumps + silences the
|
|
# placeholder warning. Same `pname` for the dep + check
|
|
# derivations so they share a clean naming family.
|
|
pname = "hyperhive-workspace";
|
|
version = "0.1.0";
|
|
inherit nativeBuildInputs;
|
|
};
|
|
}
|