Stories

CI builds each crate exactly once

The Rust workspace becomes a per-crate build DAG in Nix. A one-line change rebuilds one unit; the cache serves everything else.

cargo build in CI is all-or-nothing: touch one crate and the runner rebuilds the world, because the workspace is one opaque build to the outside. Caching means “hope the target dir survived”.

index renders the workspace’s unit graph into the Nix build graph itself: every crate (and its tests, and its clippy pass) is its own derivation with exact dependencies. A one-line change invalidates exactly the units downstream of it. Everything else is a cache hit, on CI and on every developer machine, because they share the same store.

core (edited)api: rebuiltutil: cachedcli: rebuilttests: cached

The same per-unit seam is where repo-wide lint policy attaches: the patched Clippy with house lints runs per crate and caches per crate. The machinery is lib/’s cargo-unit, proposed to go further in Plan 0005.