fix(nix): align cargo-fmt rustfmt with dev shell #39

Merged
jwilger merged 1 commit from fix/issue-12-rustfmt-alignment into main 2026-05-02 12:49:19 -07:00
Owner

Summary

  • Set the Nix cargo-fmt check's RUSTFMT environment variable to the exact rustfmt binary from the dev-shell Rust toolchain.
  • Document the formatter alignment in the Unreleased changelog.

Verification

  • nix eval --raw .#checks.x86_64-linux.cargo-fmt.RUSTFMT
  • nix develop --command sh -c 'printf %s "/nix/store/z9v3lp64k3dliwlvx7icq44a6kykarqv-rust-minimal-1.97.0-nightly-2026-05-01/bin/rustfmt"'
  • nix build .#checks.x86_64-linux.cargo-fmt
  • git diff --check -- flake.nix CHANGELOG.md

Closes #12

## Summary - Set the Nix cargo-fmt check's RUSTFMT environment variable to the exact rustfmt binary from the dev-shell Rust toolchain. - Document the formatter alignment in the Unreleased changelog. ## Verification - nix eval --raw .#checks.x86_64-linux.cargo-fmt.RUSTFMT - nix develop --command sh -c 'printf %s "/nix/store/z9v3lp64k3dliwlvx7icq44a6kykarqv-rust-minimal-1.97.0-nightly-2026-05-01/bin/rustfmt"' - nix build .#checks.x86_64-linux.cargo-fmt - git diff --check -- flake.nix CHANGELOG.md Closes #12
fix(nix): align cargo-fmt rustfmt with dev shell
All checks were successful
auto_review auto_review: 1 warning
CI / Nix flake check (pull_request) Successful in 5s
4166c43a5c
auto-review left a comment

This PR aligns the cargo-fmt check's RUSTFMT environment variable with the rustfmt binary from the dev-shell Rust toolchain, ensuring consistency between local and CI environments. The changes appear safe to merge, but ensure that the rustToolchain variable is correctly defined.

Walkthrough

  • CHANGELOG.md:
    • Added a section documenting the alignment of the cargo-fmt check with the dev-shell Rust toolchain's rustfmt binary.
  • flake.nix:
    • Updated the cargo-fmt check to set the RUSTFMT environment variable to the rustfmt binary from the dev-shell Rust toolchain, ensuring consistent formatting across environments.

Pre-merge checks

  • [~] CHANGELOG updated — diff is docs/config only — no CHANGELOG entry expected
  • [~] Tests touched — no source files in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR aligns the `cargo-fmt` check's `RUSTFMT` environment variable with the rustfmt binary from the dev-shell Rust toolchain, ensuring consistency between local and CI environments. The changes appear safe to merge, but ensure that the `rustToolchain` variable is correctly defined. ## Walkthrough - **CHANGELOG.md**: - Added a section documenting the alignment of the `cargo-fmt` check with the dev-shell Rust toolchain's rustfmt binary. - **flake.nix**: - Updated the `cargo-fmt` check to set the `RUSTFMT` environment variable to the rustfmt binary from the dev-shell Rust toolchain, ensuring consistent formatting across environments. ## Pre-merge checks - [~] CHANGELOG updated — diff is docs/config only — no CHANGELOG entry expected - [~] Tests touched — no source files in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
Collaborator

🟡 Warning: Verify that the rustToolchain variable is correctly defined and points to the intended Rust toolchain. This ensures that the correct rustfmt binary is used consistently.

🟡 **Warning:** Verify that the `rustToolchain` variable is correctly defined and points to the intended Rust toolchain. This ensures that the correct `rustfmt` binary is used consistently.
Author
Owner

Verified. rustToolchain is the single toolchain value loaded from ./rust-toolchain.toml via pkgs.rust-bin.fromRustupToolchainFile, and it is already used by both craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain and devShells.default.buildInputs. I also verified that nix eval --raw .#checks.x86_64-linux.cargo-fmt.RUSTFMT and nix develop --command sh -c 'command -v rustfmt' resolve to the same /nix/store/...-rust-minimal-1.97.0-nightly-2026-05-01/bin/rustfmt path, so no code change is needed for this thread.

Verified. `rustToolchain` is the single toolchain value loaded from `./rust-toolchain.toml` via `pkgs.rust-bin.fromRustupToolchainFile`, and it is already used by both `craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain` and `devShells.default.buildInputs`. I also verified that `nix eval --raw .#checks.x86_64-linux.cargo-fmt.RUSTFMT` and `nix develop --command sh -c 'command -v rustfmt'` resolve to the same `/nix/store/...-rust-minimal-1.97.0-nightly-2026-05-01/bin/rustfmt` path, so no code change is needed for this thread.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jwilger/auto_review!39
No description provided.