crane/lib/cargoClippy.nix
Ivan Petkov 7fc1a8fec3
Remove --workspace from all default commands
* This allows for fewer assumptions about the project structure
* The old behavior can easily be brought back by setting `cargoExtraArgs
  = "--workspace";` in any derivation
2022-07-20 19:27:52 -07:00

24 lines
540 B
Nix

{ cargoBuild
, clippy
}:
{ cargoArtifacts
, cargoClippyExtraArgs ? ""
, cargoExtraArgs ? ""
, ...
}@origArgs:
let
args = builtins.removeAttrs origArgs [ "cargoClippyExtraArgs" ];
in
cargoBuild (args // {
inherit cargoArtifacts;
pnameSuffix = "-clippy";
cargoBuildCommand = "cargo clippy --release --all-targets";
cargoExtraArgs = "${cargoExtraArgs} ${cargoClippyExtraArgs}";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ clippy ];
doCheck = false; # We don't need to run tests to benefit from `cargo clippy`
})