ci: unify toolchain through the Nix flake#92
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
1859498 to
1dc7059
Compare
restore_verified builds its dropped-paths Vec by iterating a HashMap, so the order is non-deterministic. The exact-equality assertion passed by luck on the CI runner but failed under a different hash seed (surfaced by the sandboxed Nix build). Sort both sides before comparing; the dropped order is not part of the function's contract.
Make the flake dev shell the single source of every tool, mirroring the kiln repo. `nix develop` provisions the toolchain and installs a pre-commit hook (rustfmt, nixfmt, markdownlint, cspell) via git-hooks.nix; `nix flake check` runs the same hooks. CI now runs each job through `nix develop -c`, replacing the dtolnay toolchain and the standalone pnpm setup, and adds a `nix build` job on Linux and macOS. Clippy, tests, and coverage stay as cargo invocations (with cargo caching) rather than flake-check derivations, so incremental builds keep working. The generated .pre-commit-config.yaml is gitignored.
1dc7059 to
ce127c9
Compare
Aliasing of nixfmt-rfc-style to nixfmt in 26.05 surfaces a deprecation warning; switch the hook to the canonical name.
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.
Summary
Make the Nix flake dev shell the single source of every tool.
nix developprovisions the toolchain and installs a pre-commit hook;nix flake checkruns the fast hooks; and every CI job runs throughnix develop -c, so local and CI use the exact same toolchain. Replaces thedtolnay/rust-toolchain+ standalonepnpmsetup.Design decisions
nix flake checkruns only the compile-free hooks (rustfmt, nixfmt, markdownlint, cspell). Clippy, tests, and coverage stay asnix develop -c cargo ...jobs soSwatinem/rust-cachekeeps incremental builds fast. Folding them into flake-check derivations would recompile the whole workspace every run with no cargo cache.git-hooks.nix, gitignored. The.pre-commit-config.yamlis generated from the flake and pinned through the lock; pnpm-based hooks no-op whennode_modulesis absent so the sandboxednix flake checkpasses.setup-nixcomposite action +nix buildjob on Linux and macOS.cargo-llvm-covandllvm-tools-previewin the dev shell, so coverage runs vianix developwithout a separate install action.nixos-26.05(rustc 1.95.0). The 26.05 alias ofnixfmt-rfc-styletonixfmtis adopted to clear its deprecation warning.Changes
flake.nixgit-hooks-nixinput,preCommitCheck, dev shell (toolchain + llvm-cov + node),checks.pre-commit, nixpkgs26.05flake.lockgit-hooks-nixand transitive inputs; nixpkgs25.11→26.05.github/actions/setup-nix/action.yml.github/workflows/ci.ymlnix develop -c.gitignore.pre-commit-config.yamland Nix artifacts.cspell/words.txtcachix,direnvCLAUDE.mdnix develop/nix flake checkunder Verificationfile_tracker.rsrestore_verifieddropped paths (see note)Notes
restore_verified_returns_paths_of_dropped_snapshotsasserted exactVecorder, butrestore_verifiedbuilds thatVecfrom aHashMap(non-deterministic order). It passed by luck on the CI runner and failed under the sandbox's hash seed. Committed separately astest(file_tracker): ....Test plan
All jobs validated locally through the flake:
nix flake check: all hooks passnix develop -c cargo fmt --all --check/clippy -D warnings/cargo test(2094 pass)nix develop -c cargo llvm-cov ...: lcov generatednix develop -c pnpm install / lint / spellcheck: 0 issuesnix build .#oxide-code:ox 0.1.0-alpha.2binary producedgit commitexercises the installed hook