Skip to content

modernize the scaffold around crane, rust-overlay, and but.nix - #5

Draft
0xgleb wants to merge 1 commit into
masterfrom
feat/modernize-scaffold
Draft

modernize the scaffold around crane, rust-overlay, and but.nix#5
0xgleb wants to merge 1 commit into
masterfrom
feat/modernize-scaffold

Conversation

@0xgleb

@0xgleb 0xgleb commented Aug 12, 2026

Copy link
Copy Markdown
Member

Motivation

The template had drifted from the projects started from it. It pinned the previous nixpkgs stable, took its toolchain from fenix while every live consumer uses rust-overlay, built nothing at all (a dev shell and no package), and drove CI through the DeterminateSystems magic-nix-cache -- whose hosted cache throttled builds with HTTP 418, which is why the live repos already moved off it.

The most duplicated piece was the crane build: moneymentum/rust.nix and yielduck/rust.nix are near-identical hand-copies, differing only in crate name, the extra source directories they whitelist, and a bit of env. That belongs in the scaffold, not in each project.

Solution

  • Move to nixos-26.05 and the rust-overlay toolchain, and add crane. The duplicated build is now one mkRustPackages in nix/lib.nix, parameterized by pname and the non-Cargo source directories a build reads (extraSrcDirs).
  • Expose the crane derivations as checks named cargo-test and cargo-clippy. The names are project-agnostic on purpose: the workflow shipped by templates.ci builds them by name, so it works unchanged in any consuming project instead of needing per-project aliases.
  • Take the GitButler CLI and its agent skill from but.nix rather than leaving each project to package them, and expose pr-stack-footer.
  • Refresh the hook set to what the live projects run: nil, nixfmt, actionlint, taplo, rustfmt --edition 2024, and deno fmt on markdown. The markdown hook is disabled in interactive shells -- deno's V8 has no reliable aarch64-darwin substitute and builds for hours -- but still gates CI through the git-hooks check.
  • Add AGENTS.md with the conventions common to both live projects, CLAUDE.md symlinked to it, and a ## Project Direction placeholder each new project fills in.
  • Migrate both CI workflows to nix-quick-install + Cachix + cache-nix-action, and bring templates/nix in line with the new inputs and lib API.

Verification

  • cargo-test, cargo-clippy, and ci-template-mirror all build.
  • The dev shell provides but 0.22.0, cargo 1.97.1, and cargo-nextest.
  • nix flake init -t .#nix produces a flake that evaluates against this checkout.
  • Note: nix flake check on aarch64-darwin will build deno from source via the markdown hook. CI runs on linux, where it substitutes.

The template had drifted from the projects started from it. It pinned the previous nixpkgs stable, took its toolchain from fenix while every live consumer uses rust-overlay, built nothing (only a dev shell), and drove CI through the DeterminateSystems magic-nix-cache, whose hosted cache throttled builds with HTTP 418.

- Move to nixos-26.05 and the rust-overlay toolchain, and add crane. The package/test/clippy derivations that moneymentum and yielduck each hand-copied are now one mkRustPackages in nix/lib.nix, parameterized by pname and the non-Cargo source directories a build reads.
- Expose the crane derivations as checks named cargo-test and cargo-clippy. The names are project-agnostic on purpose, so the workflow shipped by templates.ci builds them by name in any consuming project rather than needing per-project aliases.
- Take the GitButler CLI and its agent skill from but.nix instead of leaving each project to package them, and expose pr-stack-footer.
- Refresh the hook set to what the live projects run: nil, nixfmt, actionlint, taplo, rustfmt --edition 2024, and deno fmt on markdown. The markdown hook is off in interactive shells because deno's V8 has no reliable aarch64-darwin substitute; it still gates CI.
- Add AGENTS.md with the conventions shared by both live projects, with CLAUDE.md symlinked to it and Project Direction left as a placeholder to fill in per project.

Verified: cargo-test, cargo-clippy, and ci-template-mirror all build; the dev shell provides but, cargo, and cargo-nextest; and the nix-only template initializes and evaluates against this checkout.
@0xgleb 0xgleb self-assigned this Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b670600f-8cb6-4f0f-b703-844f37f74fa6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant