crane/lib/cargoTarpaulin.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
658 B
Nix
Raw Normal View History

2022-10-24 02:20:22 +03:00
{ mkCargoDerivation
2022-01-17 05:16:21 +03:00
, cargo-tarpaulin
}:
2022-10-24 02:20:22 +03:00
{ cargoExtraArgs ? ""
, cargoTarpaulinExtraArgs ? "--skip-clean --out Xml --output-dir $out"
2022-01-17 05:16:21 +03:00
, ...
}@origArgs:
let
args = builtins.removeAttrs origArgs [
"cargoExtraArgs"
"cargoTarpaulinExtraArgs"
];
2022-01-17 05:16:21 +03:00
in
mkCargoDerivation (args // {
buildPhaseCargoCommand = "cargoWithProfile tarpaulin ${cargoExtraArgs} ${cargoTarpaulinExtraArgs}";
2022-01-17 05:16:21 +03:00
pnameSuffix = "-tarpaulin";
# With `--skip-clean` cargo-tarpaulin tries to mutate dependency files in place
doNotLinkInheritedArtifacts = args.doNotLinkInheritedArtifacts or true;
2022-01-17 05:16:21 +03:00
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cargo-tarpaulin ];
})