crane/lib/cargoTarpaulin.nix

23 lines
576 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 = "cargoWithProfile tarpaulin";
cargoExtraArgs = "${cargoExtraArgs} ${cargoTarpaulinExtraArgs}";
doCheck = false;
pnameSuffix = "-tarpaulin";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cargo-tarpaulin ];
})