Flake devShell and checks for a real crate — Schema Read · Shell Seat · Check Seat
Read inputs and outputs as a schema. Name the shell. Name what nix flake check builds.
<!-- hal:authoritative:yaml -->
*Read inputs and outputs as a schema. Name the shell. Name what nix flake check builds.*
§I — Frame
Asr session 19. Topic T7 Env & CI. Fourth fire of the Nix Rust-roads block. Home: . Cite: Nix flakes CLI / schema (hub + https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html). Corpus: ~/projects/rust-tops/flake.nix (vault mirror foundry/rust-tops/repo/rust-tops/flake.nix). Secondary shapes: Facet foundry/facet/repo/facet/flake.nix, h3s ~/repos/hedronetes-h3s/flake.nix.
Session 16 named buildRustPackage. Session 17 sorted writers vs cargo-script. Session 18 mapped musl cross seats. Today the unmarked row asks the flake surface every Rust road already ships behind: what are inputs and outputs, which attrs are devShells and checks, and what does nix flake check actually run.
Verified on this Mac before drafting:
| Eval | Result |
|---|---|
devShells.aarch64-darwin attrNames | default |
checks.aarch64-darwin attrNames | cargo-tops, law-catalog, rust-tops-laws |
Today's Duha Nix packaging shell (lesson_class: duha, trait-objects crate) packages Beat A. It does not consume this Asr cursor.
Done-criteria from the syllabus: read inputs/outputs as a schema, name the devShells and checks outputs, and say what nix flake check runs.
Not POSIX floor-gate depth (Topics #20). Not Bend spike-bank (peer seat today).
§II — Schema Read (named technique)
Schema Read: treat the flake as two sealed maps, not a script.
inputs names other flakes (and how they pin). rust-tops declares nixpkgs and a Darwin-x64 pin (nixpkgs-darwin-x64) because nixpkgs 26.11 dropped Intel macOS. That is a pin story, not a lesson digression.
outputs is a function of those inputs. It returns an attrset. The keys that matter for this seat:
| Output key | Job |
|---|---|
packages | buildable packages per system |
apps | runnable programs (type = "app") |
devShells | nix develop shells |
checks | what nix flake check builds |
overlays | optional; rust-tops exposes overlays.default |
Yagyu: Schema Read means you can point at a key and say its job in one sentence. Musashi: inputs pin; outputs expose.
§III — System Fan (named technique)
System Fan: one helper that stamps every system the same way.
rust-tops:
systems = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ];
forAllSystems = f: lib.genAttrs systems (system: f system);
packages, apps, devShells, and checks all call forAllSystems. Facet uses a sibling name (forSystems) for the same idea. h3s builds devShells.${system}.default inside a systems loop. Different spellings, same fan: do not hand-write four copies of the shell.
pkgsFor on rust-tops picks the Darwin-x64 pin when system == "x86_64-darwin", else unstable. That keeps Intel macOS on a living pin without dragging every system onto it.
Chozanshi: if you need the same shell on four systems, then fan with genAttrs (or equivalent); thus one mkShell body stays the source of truth.
§IV — Shell Seat (named technique)
Shell Seat: what lands on PATH when you nix develop.
rust-tops devShells.default:
default = pkgs.mkShell {
packages = [
pkgs.cargo-tops
pkgs.rustc
pkgs.cargo
pkgs.clippy
pkgs.rustfmt
];
};
Read it as a seat map: the kit binary (cargo-tops) plus the toolchain the kit expects. Facet and h3s also expose devShells.default via mkShell. The teaching move is not to memorize package lists. It is to find the devShells key, open default, and say which tools the crate road assumes.
nix develop enters that shell. It does not, by itself, prove the checks.
§V — Check Seat (named technique)
Check Seat: name every attr under checks and what building it means.
On rust-tops (verified aarch64-darwin):
| Check attr | Meaning |
|---|---|
cargo-tops | the package itself must build |
rust-tops-laws | the laws pack derivation must build |
law-catalog | runCommand that runs scripts/bend-gate.sh with BEND_GATE_NAMES_ONLY=1 |
law-catalog is names-only on purpose. The flake comment says it does not require bend in the sandbox; host bend-gate.sh runs the Bend proof when bend is on PATH. That split is the bridge to Topics #20 (POSIX floor gate). Today you only need to see that a check can be a package or a runCommand gate.
nix flake check builds every attribute under checks for the current system (plus flake schema checks). If law-catalog fails, the flake fails. That is the CI noun for this seat: the check set is the contract, not a README hope.
Corpus honesty: quote paths from flake.nix. Do not invent check names. Do not push new checks from class.
§VI — Why this road
Asr Nix seats T7 so Rust packaging has a flake surface after crate, writer, and musl seats. Session 19 names Schema Read, System Fan, Shell Seat, and Check Seat against a real corpus flake so nix develop and nix flake check stop being slogans.
Keep the Duha/Asr split clear: Duha Beat B may package today's lesson crate under lesson_class: duha. Asr advances NIX-SYLLABUS rows under lesson_class: asr and topic: T7.
§VII — Done-criteria check
Say aloud without looking:
- Schema Read:
inputspin flakes;outputsexposepackages/devShells/checks(and friends). - System Fan:
forAllSystems/genAttrsstamps four systems from one body. - Shell Seat:
devShells.default=mkShelltool list fornix develop. - Check Seat: rust-tops checks =
cargo-tops,rust-tops-laws,law-catalog;nix flake checkbuilds them.
§VIII — Common mistakes
- Treating today's Duha Nix packaging shell as this Asr Topics #19 ship.
- Confusing
packages.defaultwithdevShells.default. - Claiming
nix flake checkruns Bend proofs when the flake only runs names-onlylaw-catalog. - Inventing check attr names without reading
flake.nixornix eval. - Jumping to POSIX floor-gate depth (row #20) before the check set is fluent.
- Editing rust-tops to add checks from this lesson.
§IX — Boundaries
- Not POSIX floor gate inside
nix flake check(Topics #20). - Not session 16/17/18 re-teach as the whole lesson.
- Not authoring Bend spike-bank review (Bend s09 peer).
- Not Python
withPackages(retired Asr lane). - Not pushing main or editing rust-tops product files.
§X — Close
Session 18 mapped musl seats. Session 19 maps Schema Read, System Fan, Shell Seat, and Check Seat against rust-tops flake.nix (Facet/h3s as secondary shapes). Next unmarked: session 20, the POSIX floor gate inside nix flake check.
Related:
Name the three check attrs. Enter the shell once in your head. Leave the keyboard.