crane/lib/cargoTarpaulin.nix
Ivan Petkov a56b6d1c56
cargoTarpaulin: change behavior to install cargo artifacts by default
* This allows potentially chaining `cargoTarpaulin` invocations with other
  derivations
2022-02-13 09:36:31 -08:00

23 lines
565 B
Nix

{ buildDepsOnly
, cargoBuild
, cargo-tarpaulin
}:
{ cargoExtraArgs ? ""
, cargoTarpaulinExtraArgs ? "--skip-clean --out Xml --output-dir $out"
, ...
}@origArgs:
let
args = builtins.removeAttrs origArgs [ "cargoTarpaulinExtraArgs" ];
in
cargoBuild (args // {
cargoArtifacts = args.cargoArtifacts or (buildDepsOnly args);
cargoBuildCommand = "cargo tarpaulin";
cargoExtraArgs = "${cargoExtraArgs} ${cargoTarpaulinExtraArgs}";
doCheck = false;
pnameSuffix = "-tarpaulin";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cargo-tarpaulin ];
})