crane/lib/cargoDeny.nix
2023-11-05 18:42:08 +00:00

28 lines
572 B
Nix

{ cargo-deny
, mkCargoDerivation
}:
{ cargoDenyExtraArgs ? ""
, cargoDenyChecks ? "bans licenses sources"
, cargoExtraArgs ? ""
, ...
}@origArgs:
let
args = builtins.removeAttrs origArgs [
"cargoDenyExtraArgs"
"cargoExtraArgs"
];
in
mkCargoDerivation (args // {
buildPhaseCargoCommand = ''
cargo --offline ${cargoExtraArgs} \
deny ${cargoDenyExtraArgs} check ${cargoDenyChecks}
'';
cargoArtifacts = null;
doInstallCargoArtifacts = false;
pnameSuffix = "-deny";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cargo-deny ];
})