crane/lib/cargoTarpaulin.nix
2022-01-16 18:16:21 -08:00

24 lines
632 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;
doInstallCargoArtifacts = args.doInstallCargoArtifacts or false;
pnameSuffix = "-tarpaulin";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cargo-tarpaulin ];
})