Repository navigation
feat(nix): Rust language pack — capability module + lib.mkRustProject - #1429
Conversation
`rust` was an ask-gated candidate in ADR-capability-modules; gerchowl/filesender is the ask. It ships as two pieces, and the split between them is the whole design. The module (nix/modules/rust.nix) stays on the v1 contract: packages, env, shellHook. It puts a toolchain and the curated cargo tooling on the dev-shell PATH, and that is the easy half of the capability. The half that earns its keep is the check suite, and a v1 module cannot contribute `checks.<system>.*`. That is not an oversight in the contract — `packages`/`env`/`shellHook` fold monoidally into one derivation, while `checks` is a namespaced map of independent peer derivations on a different lifecycle, built from the consumer's source tree, which is project shape a module never sees. The test that settled it (#1427): a `checks` field could be added to the shell-composition contract WITHOUT touching shell composition at all. If a field can be added to a contract without touching what that contract composes, it is not part of it. So lib.mkRustProject composes above mkProjectShell instead, and returns the dev shell, the checks and the packages from ONE call. There is no second function to forget. Flake outputs are still consumer-assigned by construction, so nothing here — and no contract change either — could make wiring structurally impossible. What remains is closed loudly: the module's `checks` option is mandatory with no default, so a hand-written `modules = [ "rust" ]` fails at EVAL with a message that names the fix and the deliberate opt-out (`{ name = "rust"; checks = "none"; }`). Silence was the failure mode; silence is what is removed. Notable details: - mkRustProject folds the well-known root tool configs (rustfmt.toml, clippy.toml, deny.toml, about.*, .cargo/) into the crane fileset unconditionally via maybeMissing. Their absence from a build sandbox is SILENT — rustfmt/clippy/cargo-deny fall back to built-in defaults and the check passes while enforcing rules nobody wrote. The first consumer shipped that bug twice. - The generated `checks.<system>.module-<name>` cannot instantiate a module whose options are mandatory, since it passes the bare name. The new nix/modules/check-entries.nix is the generator's per-name override; `rust` maps to the toolchain-only form. Internal plumbing, not consumer surface. - crane and fenix become flake inputs (3 leaf lock entries). Every consumer, including Python-only ones, pays for them in lock size and fetch-at-eval. The alternative — each Rust repo pinning its own fenix — is per-repo drift on exactly the axis devkit exists to hold still. mkRustProject takes overrides, so the inputs can move back out later without a consumer-visible change. - Zero-module invariant preserved: devShells.<system>.default.drvPath is byte-identical to dev (verified, not assumed). Refs: #1400, #1427
crane's buildPackage runs `cargo test` as part of the build. With the nextest check enabled that is the same suite run twice, on two separate derivations, for one signal. The package builds now set doCheck = false whenever nextest is enabled, leaving the test run to checks.nextest — which is also what CI invokes via `just test`. Gated on nextest rather than unconditional: with nextest off, dropping doCheck would mean nothing runs the tests at all. Refs: #1400
Nine tests on the rust module, and the load-bearing one is `test_rust_module_bare_form_throws_with_mkrustproject_guidance`: the whole design rests on `modules = [ "rust" ]` refusing to evaluate, so that refusal gets a fixture asserting it fires AND that the message names both the fix and the option. The rest cover the registry entry, the generated module-rust check, the explicit opt-out, and the three rejection paths (unknown option, invalid `checks` value, unknown tool). The parity test is the other half: devShells.<system>.default.drvPath must be byte-identical to a bare mkProjectShell, so the rust module's existence cannot perturb the zero-module invariant. No inventory test enumerating capability modules exists, so nothing needed `rust` added. ADR-capability-modules gains the #1427 decision, the honest limitation (flake outputs are consumer-assigned by construction, so no contract change could have made wiring structurally impossible), the bar for revisiting, the two rejected options, and a subsection documenting check-entries.nix as internal plumbing. `rust` moves out of the ask-gated candidate list into shipped. Also in this commit: RUSTDOCFLAGS moves to a top-level attr on the doc check so a consumer's `buildEnv` cannot collide with it through two mechanisms, and the new banners say `inputs.devkit` rather than `inputs.devcontainer` — the repo is devkit now. Refs: #1400, #1427
End-to-end result on the first consumer
The
|
85% of what crane+fenix cost a downstream consumer was one transitive input devkit never chose. fenix pulls the rust-analyzer SOURCE TREE to build its *nightly* rust-analyzer derivation — which this pack never touches, because fromToolchainFile takes its components from the release-channel manifest instead. Following it to nixpkgs removes the node outright rather than replacing it, since every consumer already has nixpkgs. Lock nodes 15 -> 14, fetched source ~33 MB -> ~5 MB. Verified rather than reasoned about, because the obvious worry is that this breaks the rust-analyzer component: built a toolchain from filesender's rust-toolchain.toml (which lists rust-analyzer) with the follows in place, and result/bin contains rust-analyzer alongside cargo, clippy, rustfmt and rustc. filesender's full nix flake check stays green on all nine checks. Measured while spiking #1440, which also corrected a claim I had made about what these inputs cost. Deleting an unreferenced 20.8 MB input from the store and re-running each operation shows nix eval, flake show, flake check, flake metadata, develop and build all leave it absent; only flake archive and re-locking fetch it. So the recurring cost of a shared input is confined to nix flake update, not to everyday consumer operations. That measurement is on Nix 2.34.7+1 with fetch-tree and no lazy-trees; another Nix may differ, and CI images should be re-measured. This lands the part of #1440 that every reviewer agreed on regardless of how the larger question goes. Whether crane and fenix belong in devkit at all is still open there. Refs: #1440
Second consumer:
|
| tests run | |
|---|---|
cargo test --all-features (squelch's actual suite) |
59 |
cargo test (default features) |
55 |
the pack's nextest |
55 |
Plus 0 of 3 doctests, per §3 — so 55 of 62 signals.
The four missing tests cover gh-cli, endpoint and serde, and more importantly clippy never compiles that code at all. For a crate whose README sells default-features = false, the pack's green is narrower than the repo's own cargo test — and nothing says so.
clippyExtraArgs exists, but there is no features / cargoExtraArgs knob reaching buildDepsOnly, nextest, doc or the package builds.
What works today, found by reading the source rather than the docs:
buildEnv = { cargoExtraArgs = "--all-features"; }; # → 59 tests runbuildEnv is documented as "For CMAKE_*, PKG_CONFIG_PATH, etc." but is merged verbatim into commonArgs, so it is a general crane override wearing an env-var name. It works, it is the only seam, and it is the kind of thing that gets removed in a refactor because the docstring says it holds env vars. Worth either promoting to a real cargoExtraArgs/features argument, or renaming what it is.
(Note it would also collide with buildCrate's own cargoExtraArgs = "-p ${name}" on a workspace — squelch is single-crate so it did not bite here.)
Claims I checked, which held
- "3 leaf lock entries." Exact.
origin/dev11 nodes → this branch 14:crane,fenix,rust-analyzer-src.flake-utils/systemswere already there. - The bare-module refusal fires, and the message is the right length and says the right things. It cost me nothing in practice — I only hit it by deliberately testing it.
toolchainHash = fakeHash→ build prints the real hash → paste → works, first try. The error text explaining why there is no sensible default is why it took thirty seconds instead of a search.- The
doccheck found real defects on first execution, exactly as it did on filesender. Two broken intra-doc links in squelch'smain, both pointing atendpoint-gated items from ungated docs (crate::Auth::Dynamic,Transport::Endpoint) — so they were broken for every default-features reader. Nothing else in the repo's suite looks at rustdoc. Fixed in the consumer.
Answers to the three review asks
- crane + fenix as devkit inputs — from a consumer's seat, keep them. Three entries is cheap, and the alternative is every Rust repo pinning its own fenix, which is per-repo drift on the exact axis devkit exists to hold still. The reversibility note in the PR (overrides exist) is the right safety valve.
check-entries.nix— reads fine. A name-keyed override, small, with a comment stating the bar for adding one. Therustentry usingchecks = "none"is honest: the smoke check owns no source tree, which is precisely the sanctioned opt-out case.- Is the eval refusal too aggressive? No — and I would say the opposite is the finding. The refusal never fired in normal use. The thing that actually cost me time was §1, which is silent and produces a half-working repo. Spend the aggression there.
Incidental confirmation of #1400's ask 3
The nix-detection false-negative is real and I hit it without looking for it: squelch is a single-flake.nix repo, so it is never nix-detected, never gets the nix .gitignore fragment, and the first nix build left an untracked result symlink in git status. Had to add /result + /result-* by hand. Every direnv-mode Rust consumer will do this, because a Rust pack repo is a single-flake repo by construction.
Two smaller notes
- Darwin noise: building the fenix toolchain prints dozens of
install_name_tool: command not foundlines. The toolchain works, but on a first adoption it reads as a broken build for about a minute. - Shell weight: a pure-Rust library's
nix developcarries the full devkit toolchain SSoT —podman,nodejs,uv,python3,ruff,pymarkdownlnt,bats,neovim,tmux,claude-code— ~45 packages, of which the Rust pack contributes 7. That is devkit policy rather than a pack bug, and it is the first thing a Rust-only consumer notices.
…c ratchet Two pieces: the kit, and a gate that can hold a line without becoming noise. TOOL GROUPS. `tools` entries may now start with `@` and expand to a curated set: @Perf (samply first — sampling profiler, no root, no perf_events, works on both platforms, which makes it the 2026 default; then flamegraph, hyperfine, criterion, bloat, llvm-lines, show-asm, and heaptrack/valgrind/poop where they exist), @perf-async (samply, tokio-console, hyperfine — for tiers whose stalls are awaits, not CPU) and @api (semver-checks, expand). A group SKIPS members this platform lacks; an explicitly named tool does not. That asymmetry is the reason groups exist: asking for @Perf is asking for this platform's kit, but naming heaptrack is a request that can only be met or refused, and silently dropping it would hand someone a shell missing the one tool they asked for. Without groups every consumer writes the same `optionals isLinux` by hand and some get it wrong. THE RATCHET. checks.perf-ratchet, auto-enabled when .repo/perf-baseline.toml exists — the same adopt-by-existing rule as deny. It times nothing, on purpose. Wall-clock benchmarks on shared CI runners move more with neighbours and thermal state than with most real regressions, and a gate that fires on noise is one people learn to re-run until it passes. The pack ADR already says coverage is reported and never gated; this is the same reasoning, harder, because a flaky perf gate teaches --no-verify. What it measures is deterministic given a locked toolchain and a locked graph, so a change means a change: shipped binary size per binary, and dependency-graph size read from Cargo.lock at eval. Neither needs anyone to have authored a benchmark — which is the point, because a ratchet nobody has to write is a ratchet that is actually in place. Repos doing real performance work add criterion/divan benches and run them off the CI critical path; @Perf is what puts that kit on PATH. It is a ratchet, not a limit: growth past the tolerance fails, a measured shrink is REPORTED so it can be banked, and the baseline is committed so the diff shows who spent the budget. packages.perf-seal emits the baseline file itself, so sealing is never hand-transcribed. Verified by firing it, not by reading it. On filesender: sealed a baseline (filesender 2672624 B, filesender-mcp 3629360 B, 220 crates), confirmed the check goes green, then tightened the baseline and confirmed REGRESS on both the binary (+33%) and the graph (+10%) while the untouched binary stayed ok, with the build failing and the guidance (cargo bloat / llvm-lines / tree --duplicates, then perf-seal) printed. Three new tests cover group expansion contributing a non-identical derivation, the explicit-unavailable throw, and the unknown-group throw; the rust set is 12 passing. Refs: #1400, #1440
Four eval-time tests from adopting the Rust pack on a second consumer (single-crate library, no binaries, heavily feature-gated): - a pkgs without devkit's overlay must name overlays.default rather than dying on `undefined variable 'vig-utils'` inside devtools.nix - a tree with no Cargo.lock must fail through fmt too, which took only `src` and so passed while the other five derivations failed - checks must include a doctest entry, which #1400's stage table assigns to pre-push and #1429 did not ship - cargoExtraArgs must reach commonArgs, so the checks can build features other than the default set A dependency-free fixture crate keeps the lockfile a literal, so all four run at eval — no vendoring, no network, no compile. Refs: #1450
Two guards and two additions, all from a second consumer's adoption. The guards replace failures that were opaque or partial: - a pkgs without devkit's overlay now names overlays.default and says which outputs need it, instead of dying on `undefined variable 'vig-utils'` inside devtools.nix. Checked lazily, on the dev shell alone: checks and packages never reach mkProjectShell and are usable against a plain nixpkgs, so an eager throw would break a working configuration to improve a message. - a source tree with no Cargo.lock now says so, and says why a git-tree source is the reason. The check sits on cleanSrc so fmt fails with the rest rather than passing alone and making a total failure look partial. The additions close gaps the suite did not admit to: - checks.doctest runs `cargo test --doc`, which #1400 assigned to pre-push. nextest cannot run doctests and cargoDoc only lints rustdoc, so adopting the pack silently dropped them. - cargoExtraArgs reaches every derivation, so the checks can build features other than the default set. Composed with `-p <crate>` in buildCrate rather than overwritten, so a workspace's per-crate builds cannot end up with a different feature set from the checks that ran against them. Refs: #1450
Folded into the existing Rust language pack entry rather than opened as a separate one: the fixes land before the pack has shipped, so a reader of the released notes never saw the behaviour being corrected. Refs: #1450
|
Follow-up: the four findings above are now a PR against this branch — #1452 ( Two guards (overlay-less Validated end-to-end on the consumer with Take it or leave it — it is your branch, and the |
Added: performance tooling + a ratchet, and the #1440 partial landing1.
|
| group | contents |
|---|---|
@perf |
samply, cargo-flamegraph, hyperfine, cargo-criterion, cargo-bloat, cargo-llvm-lines, cargo-show-asm + heaptrack/valgrind/poop on Linux |
@perf-async |
samply, tokio-console, hyperfine |
@api |
cargo-semver-checks, cargo-expand |
samply leads @perf because it is the 2026 default: sampling, no root, no perf_events, works on Linux and macOS.
A group skips members this platform lacks; an explicitly named tool does not. That asymmetry is the reason groups exist — asking for @perf is asking for this platform's kit, but naming heaptrack is a request that can only be met or refused, and silently dropping it hands someone a shell missing the tool they asked for. Otherwise every consumer hand-writes the same optionals isLinux and some get it wrong.
3. The ratchet — checks.perf-ratchet
Auto-enabled when .repo/perf-baseline.toml exists (same adopt-by-existing rule as deny). packages.perf-seal emits the baseline file itself, so sealing is never hand-transcribed.
It times nothing, on purpose. Wall-clock benchmarks on shared CI runners move more with neighbours and thermal state than with most real regressions, and a gate that fires on noise is one people learn to re-run until it passes. The pack ADR already says coverage is reported and never gated; this is the same reasoning, harder, because a flaky perf gate teaches --no-verify.
What it measures is deterministic given a locked toolchain and lockfile:
- shipped binary size, per binary
- dependency-graph size, read from
Cargo.lockat eval
Neither requires anyone to author a benchmark — which is the point. A ratchet nobody has to write is a ratchet that is actually in place. Repos doing real performance work add criterion/divan benches and run them off the CI critical path; @perf puts that kit on PATH.
Growth past the tolerance (default 5%) fails; a measured shrink is reported so the win can be banked. The baseline is committed, so the diff records who spent the budget.
Verified by firing it, not by reading it
On filesender — sealed a baseline, confirmed green, then tightened it:
REGRESS binary/filesender = 2672624 bytes (baseline 2000000, +33%)
ok binary/filesender-mcp = 3629360 bytes (baseline 3629360, 0%)
REGRESS graph/crates = 220 crates (baseline 200, +10%)
Build fails, guidance prints (cargo bloat / llvm-lines / tree --duplicates, then re-seal). Both directions covered — fires on bad, quiet on good.
Three new tests (group expansion produces a non-identical derivation; explicit-unavailable throws; unknown group throws). Rust set: 12 passing. filesender: 10 checks green against this pushed branch.
One more find in the consumer
Restating tools surfaced that llvm-cov was never in filesender's dev shell, while just test-cov has always named it — it would have died on "command not found" the first time anyone ran coverage. Sixth instance in that branch's history of configured-referenced-absent. Every binary its justfile names now resolves inside nix develop, checked by running the resolution rather than reading the list.
…1452) Targets `feature/1400-rust-language-pack`, not `dev` — these are fixes to the pack before it ships, so a reader of the released notes never sees the behaviour being corrected. Everything here came out of adopting #1429 on a second consumer, `gerchowl/squelch`: a **single-crate library, no binaries, heavily feature-gated** (`browser`/`logs` default; `gh-cli`, `endpoint`, `serde` optional), wired from scratch rather than migrated. Full adoption report is the comment on #1429. Closes #1450. ## Two guards Both replace a failure that was opaque, partial, or both. Both follow the `toolchainHash` error's shape, which is the best error in the pack: say what happened, say why no default could be right, give the exact line to add. **`pkgs` without `overlays.default`.** `mkProjectShell` pulls `nix/devtools.nix`, which resolves `vig-utils` from devkit's overlay. Without it the shell died on `undefined variable 'vig-utils'` — an error inside devkit, naming something the consumer has never seen, from a file they did not open. The reason this is a guard and not a docs fix: **`checks` and `packages` never touch `mkProjectShell`**, so they evaluate fine without the overlay. Unguarded, that is a repo with a green `nix flake check` and a dev shell that has never once evaluated. Checked lazily, on the dev shell alone — an eager throw would break a configuration that legitimately uses only the checks. **Missing `Cargo.lock`.** A flake's `src` is the git tree, so a repo that gitignores its lockfile — the long-standing library convention, and what `cargo new --lib` wrote for years — hands crane a source without one. crane's own message is good, but only reachable from the derivations that vendor: `cargoFmt` takes `src` alone and **passed**, which made a total failure look partial. The guard sits on `cleanSrc` so `fmt` fails with the rest. ## Two gaps the suite did not admit to **`checks.doctest`.** #1400's stage table assigns pre-push `nextest` **and** `cargo test --doc`. nextest cannot run doctests (process-per-test has nowhere to put them) and `cargoDoc` only lints rustdoc, so nothing executed them — a consumer whose doctests ran under `cargo test` lost them on adoption, silently. `crane` already ships `cargoDocTest`; this is one `optionalAttrs` block. **`cargoExtraArgs`.** The checks built default features only, and nothing reached `buildDepsOnly` / `nextest` / `doc` / the package builds — `clippyExtraArgs` covers clippy alone, and carries lint flags rather than feature selection. On squelch that was 55 of 59 tests, with the gated code never compiled and therefore never linted. The suite reported success over the gap. Composed with `-p <crate>` in `buildCrate` rather than overwriting it, so a workspace's per-crate builds cannot end up with a different feature set from the checks that ran against them. The seam that worked before this was `buildEnv = { cargoExtraArgs = …; }`, since `buildEnv` is a raw `commonArgs` merge wearing an env-var name. Left in place, now commented as what it actually is. ## Verified - `uv run pytest tests/test_flake_modules.py -k "rust or mk_rust"` — **13 passed**, including the zero-module parity invariant. - The four new tests were committed failing first, and each fails for its own reason before the implementation commit. - **End-to-end on the consumer**, with `--override-input devkit` pointed at this branch: `nix flake check` green on **6** checks, `doctest` executing squelch's 3 doctests, and `cargoExtraArgs = "--all-features"` replacing the `buildEnv` workaround. ## Note on scope The fixture crate is written to `tmp_path` at test time rather than committed under `tests/fixtures/`, deliberately: a `Cargo.toml` inside devkit would make devkit look like a Rust consumer to its own language detection. Refs: #1450
Both targets exist only under the `endpoint` feature, so `cargo doc` on a default build reported them as unresolved — meaning the links were broken for every reader who was not building with all features. Found by the rustdoc check in devkit's Rust language pack (vig-os/devkit#1429) on its first execution against this repo; nothing in the existing suite looks at rustdoc.
Wires vig-os/devkit#1429's `lib.mkRustProject`: one call yields the dev shell, the checks and the package. `nix flake check` covers fmt, clippy, nextest, rustdoc and the crate build. Three repo changes the pack requires, each load-bearing: - Cargo.lock is now tracked. A flake's source is the git tree, so an ignored lock is absent inside the build sandbox and every crane derivation fails to vendor. Committing it is also current Cargo guidance for libraries. - rust-toolchain.toml pins the compiler; fenix resolves it so nix and a local rustup agree. toolchainHash is its content hash and moves with it. - /result is ignored — devkit does not detect a single-flake repo as a nix consumer, so its gitignore fragment never arrives (devkit#1400). `buildEnv.cargoExtraArgs = "--all-features"` is a workaround, not the intended seam: mkRustProject has no feature knob, and without it the checks build default features only — 55 of 59 tests, with the gh-cli, endpoint and serde code never compiled and so never linted.
…craneArgs Follow-ups from the second-consumer review in #1452, both on things that review either surfaced or deliberately left to me. THE SENTINEL NEEDED ITS OTHER HALF. #1452's overlay guard is right and the error is good, but `hasOverlay = pkgs ? vig-utils` is a PROXY: it infers "the overlay was applied" from one package name. Proxies drift. If devkit's overlay ever renames or drops vig-utils, the guard starts throwing "you did not apply the overlay" at consumers who did — and the shipped test would still pass, because it asserts a throw. That is the rule this whole branch is built on, applied to the branch itself: a gate is unverified until it has fired on known-bad input AND stayed quiet on known-good. The guard arrived with only the first half. The new positive test evaluates rust.devShell WITH the overlay, so the day the sentinel stops tracking what it stands for, something fails. BUILDENV WAS A LIE OF OMISSION. #1452 found that feature selection had exactly one seam reaching buildDepsOnly, and it was an argument documented as holding CMAKE_* and PKG_CONFIG_PATH. They added a real `cargoExtraArgs` and left the naming question to me, correctly. It is now `craneArgs`, documented as what it is: raw attrs merged last into every crane derivation, beating everything above them. `buildEnv` stays accepted as a deprecated alias so the second consumer's flake keeps evaluating — merged after craneArgs, on the reasoning that anyone still passing the old name means it. Reviewed the rest of #1452 by running it rather than reading it: the pinned crane does expose cargoDocTest, filesender's check set is 11 with `doctest` present and executing (zero doctests there, so vacuous on this consumer but live on squelch's three), and the rust suite is 16 green, 19 with these two. Refs: #1450, #1400
Reviewed #1452 — merged, plus two follow-upsReviewed by running it rather than reading it. All four findings are legitimate; §3 (doctests) is a regression I shipped, and the catch is a good one — I knew nextest can't run doctests (it's written in filesender's justfile, in a comment explaining why Verified independently:
Follow-up 1 — the overlay guard needed its other halfThe guard is right and the error is the best kind. But That is this branch's own rule turned on the branch: a gate is unverified until it has fired on known-bad input and stayed quiet on known-good. Follow-up 2 —
|
Both sides appended to CHANGELOG's Unreleased/Added block, so the conflict is textual only and both sets of entries are kept. The .devcontainer mirror is regenerated from the resolved file rather than resolved by hand, since sync-manifest owns it. Refs: #1400
CI's Project Checks gate failed on checks.statix: three dotted `fenix.*` keys in `inputs` trip "avoid repeated keys in attribute sets". The existing inputs use the dotted form with only two keys each, which is under whatever statix tolerates; adding the rust-analyzer-src follows made it three. Rewritten as a single attrset, comments intact. Found by CI rather than locally because I had verified with `nix flake check --no-build`, and statix is a check that must BUILD to say anything. That is this branch's own lesson landing on me: a gate that is configured and not executed reports nothing, and `--no-build` is a way to not execute one while believing you ran the suite. Verified here with a full `nix flake check` — all checks passed, lock unchanged at 14 nodes. Refs: #1400
Ships the Rust language pack as two pieces, and the split between them is the design. Implements the
A + D + assertresolution recorded in #1427.Closes #1400. Refs #1427.
How to test it
Set
toolchainHash = pkgs.lib.fakeHashfirst; the build failure prints the real one.Toolchain-only, no check suite — deliberate and explicit:
And the thing that should NOT work:
What's here
nix/modules/rust.nixnix/mk-rust-project.nixlib.mkRustProject— dev shell, checks and packages from one callnix/modules/check-entries.nixmodule-<name>check instantiates a module whose options are mandatoryChecks produced: the per-crate builds, plus
clippy,fmt,nextest,doc(rustdoc warnings denied) anddeny(auto-enabled when adeny.tomlexists).Why checks are a lib function and not a contract field
packages/env/shellHookfold monoidally into one derivation — the shell.checksis a namespaced map of independent peer derivations on a different lifecycle (nix flake check, notnix develop), built from the consumer's source tree, which is project shape a module never sees.The test that settled it: a
checksfield could be added to the shell-composition contract without touching shell composition at all. If a field can be added to a contract without touching what that contract composes, it isn't part of that contract.So
mkRustProjectcomposes abovemkProjectShelland returns all three together. One call — there is no second function to forget.Why the module refuses to load bare
modules = [ "rust" ]would hand you a toolchain, a greennix flake checkthat builds nothing, and CI that compiles nothing: the exact silent-green failure the pack exists to prevent, delivered by the pack. So the module'schecksoption is mandatory with no default, and the bare form throws at eval with a message naming the fix and the opt-out.Being straight about the limit: flake outputs are consumer-assigned by construction. No option here — including extending the contract — could have made correct wiring structurally impossible. What this shape buys is one call instead of two,
checksarriving visibly besidedevShell, and a loud eval-time failure on the one remaining path. Silence was the failure mode; silence is what's removed.Costs, stated plainly
crane+fenixbecome devkit inputs — 3 leaf lock entries that every consumer pays for, Python-only ones included, in lock size and fetch-at-eval. The alternative is each Rust repo pinning its own fenix, which is per-repo drift on exactly the axis devkit exists to hold still.mkRustProjecttakescrane/fenixoverrides, so the inputs can move back out later without a consumer-visible change. Flag it if you disagree — this is the most reversible-but-annoying-later decision in the PR.nix/lib/turned out to be gitignored (.gitignore:17has a barelib/from the Python layout, which swallows anylibdirectory at any depth). The file lives atnix/mk-rust-project.nixinstead, matchingnix/hooks.nix/nix/devtools.nix. Worth fixing that pattern separately — it will bite someone else.Verified, not assumed
checks.<system>.module-rustevaluates ✅modules = [ "rust" ]throws the guidance error ✅devShells.<system>.default.drvPathis byte-identical todev✅gerchowl/filesender, a cli + mcp + lib workspace): its ~120 lines of hand-rolled crane/fenix wiring were deleted and replaced by onemkRustProjectcall; all 9 checks evaluate and build.Two bugs this shape prevents by construction
Both were shipped by the first consumer, and both were invisible to inspection:
deny.tomloutside the crane fileset — anopensslban that banned nothing.clippy.tomloutside the fileset — the sandboxed clippy check ran against defaults, enforcing rules nobody wrote.mkRustProjectfolds the well-known root tool configs (rustfmt.toml,clippy.toml,deny.toml,about.*,.cargo/) into the fileset unconditionally viamaybeMissing, so there is nothing to remember and nothing to keep in sync.Found by devkit's own gates, on devkit
Worth recording because it is the same failure class this PR is about. My first branch was
feat/rust-language-packand the first two commits saidRefs #1400without the colon. Both were wrong by devkit's own rules — the taxonomy isfeature, notfeat, andRefs:is a mandatory trailer — and both went through, because a freshgit clonehas no hooks installed until something installs them. They were caught only when the hooks happened to be present for the third commit.That is exactly the shape of the five bugs in the first consumer's history: configured, believed active, never executed. Branch renamed, trailers normalized, commits signed. But a fresh clone of devkit does not enforce devkit's rules until someone runs the installer, and nothing tells you that. Probably worth its own issue.
Review asks
crane/fenixas devkit inputs tradeoff above.check-entries.nix— is a per-name generator override the right answer for mandatory-option modules, or should the generated smoke check learn about them some other way?