modernize the scaffold around crane, rust-overlay, and but.nix - #5
Draft
0xgleb wants to merge 1 commit into
Draft
Conversation
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.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.nixandyielduck/rust.nixare 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
nixos-26.05and the rust-overlay toolchain, and add crane. The duplicated build is now onemkRustPackagesinnix/lib.nix, parameterized bypnameand the non-Cargo source directories a build reads (extraSrcDirs).cargo-testandcargo-clippy. The names are project-agnostic on purpose: the workflow shipped bytemplates.cibuilds them by name, so it works unchanged in any consuming project instead of needing per-project aliases.but.nixrather than leaving each project to package them, and exposepr-stack-footer.rustfmt --edition 2024, anddeno fmton 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 thegit-hookscheck.AGENTS.mdwith the conventions common to both live projects,CLAUDE.mdsymlinked to it, and a## Project Directionplaceholder each new project fills in.templates/nixin line with the new inputs and lib API.Verification
cargo-test,cargo-clippy, andci-template-mirrorall build.but0.22.0, cargo 1.97.1, and cargo-nextest.nix flake init -t .#nixproduces a flake that evaluates against this checkout.nix flake checkon aarch64-darwin will build deno from source via the markdown hook. CI runs on linux, where it substitutes.