ipetkov / crane

A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.
https://crane.dev
MIT License
969 stars 92 forks source link

mkDummySrc: ignore clippy warnings in dummyrs #587

Closed szlend closed 7 months ago

szlend commented 8 months ago

Motivation

I'd like to be able to run cargo clippy in buildDepsOnly without it exiting early due to warnings/errors in the dummy file. The PR adds #![allow(clippy::all)] to the dummy file.

Why?

It can be tricky to get optimal cargo artifact cache reuse between a custom mkCargoDerivation and buildDepsOnly. Especially when you're trying to hide the low level crane/nix details and expose a simple caching interface for CI.

What I've ended up doing is to simply run the exact same cargo command first in buildDepsOnly and then mkCargoDerivation. This guarantees that everything will be built the exact same way without having to keep all the flags (--workspace, --all-targets, --features, etc.) in sync between the cargoArtifacts and the final derivation.

Checklist