crane/lib/buildWithCargo.nix
Ivan Petkov edcb983805
Change doCopyTarget to always imply a separate output
* We can simplify the configuration by removing the
  `doCopyTargetToSeparateOutput` parameter
* If a caller wants to copy target artifacts into any other output, it
  is pretty trivial for them to add their own logic for it
2021-12-26 20:11:22 -08:00

37 lines
631 B
Nix

{ cargo
, configureCargoCommonVarsHook
, configureCargoVendoredDepsHook
, copyCargoTargetToOutputHook
, lib
, stdenv
}:
{ doCopyTarget ? true
, nativeBuildInputs ? [ ]
, outputs ? [ "out" ]
, ...
}@args:
stdenv.mkDerivation (args // {
inherit
doCopyTarget;
nativeBuildInputs = nativeBuildInputs ++ [
cargo
configureCargoCommonVarsHook
configureCargoVendoredDepsHook
copyCargoTargetToOutputHook
];
outputs = outputs ++ lib.optional doCopyTarget "target";
buildPhase = ''
cargo check --release
'';
installPhase = ''
runHook preInstall
mkdir -p $out
runHook postInstall
'';
})