Skip to content

feat(nix): migrate to crane for Rust builds#128

Draft
billf wants to merge 3 commits into
masterfrom
billf/chore-nix-move-to-crane
Draft

feat(nix): migrate to crane for Rust builds#128
billf wants to merge 3 commits into
masterfrom
billf/chore-nix-move-to-crane

Conversation

@billf

@billf billf commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

Add crane (github:ipetkov/crane) for building and testing the Rust
workspace. Crane provides incremental builds by caching dependencies
separately from source changes.

Key changes:

  • Add nix/crane.nix module with craneLib setup using fenix toolchain
  • cargoArtifacts via buildDepsOnly enables dependency caching
  • Expose crane checks: cargo-fmt, cargo-clippy, cargo-nextest
  • Export packages.default as the crane-built crate
  • Use craneLib.devShell with inputsFrom for inherited build inputs
  • Include musl target configuration on Linux for static linking

Benefits:

  • Faster CI via cached dependency artifacts
  • nix flake check runs fmt, clippy, nextest, and build
  • Shared artifacts between clippy, nextest, and coverage derivations

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

@billf

billf commented Jan 10, 2026

Copy link
Copy Markdown
Contributor Author

This change is part of the following stack:

Change managed by git-spice.

@billf
billf force-pushed the billf/chore-nix-move-to-crane branch 2 times, most recently from 68cd63f to ba36476 Compare January 10, 2026 00:19
billf and others added 2 commits January 9, 2026 16:22
Add crane (github:ipetkov/crane) for building and testing the Rust
workspace. Crane provides incremental builds by caching dependencies
separately from source changes.

Key changes:
- Add `nix/crane.nix` module with craneLib setup using fenix toolchain
- `cargoArtifacts` via `buildDepsOnly` enables dependency caching
- Expose crane checks: `cargo-fmt`, `cargo-clippy`, `cargo-nextest`
- Export `packages.default` as the crane-built crate
- Use `craneLib.devShell` with `inputsFrom` for inherited build inputs
- Include musl target configuration on Linux for static linking

Benefits:
- Faster CI via cached dependency artifacts
- `nix flake check` runs fmt, clippy, nextest, and build
- Shared artifacts between clippy, nextest, and coverage derivations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@billf
billf force-pushed the billf/chore-nix-move-to-crane branch from ba36476 to 87cf5cc Compare January 10, 2026 00:38
Pin to LLVM 18 bintools for stability with WIT-generated symbol names
containing '@' characters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@billf
billf force-pushed the billf/chore-nix-move-to-crane branch from 87cf5cc to 334d0ed Compare January 10, 2026 00:52
@github-actions

Copy link
Copy Markdown

Code Coverage Report

Package Base Coverage New Coverage Difference
nix/store/rzi7hgxc7glsnjd1c2lp1afi23xpm93z-rust-mixed/lib/rustlib/src/rust/library/std/src/sys/thread_local/native/mod.rs 🔴 0% 🟢 100% 🟢 100%
src/filter.rs 🔴 0% 🔴 44.68% 🟢 44.68%
src/graph.rs 🔴 0% 🟢 79.4% 🟢 79.4%
src/path.rs 🔴 0% 🟢 100% 🟢 100%
src/trampoline.rs 🔴 0% 🟠 73.04% 🟢 73.04%
Overall Coverage 🟢 18.24% 🟢 80.13% 🟢 61.89%

Minimum allowed coverage is 0%, this run produced 80.13%

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