2021-12-27 03:18:22 +03:00
|
|
|
{ cargo
|
2021-12-27 04:10:04 +03:00
|
|
|
, configureCargoCommonVarsHook
|
2021-12-27 03:18:22 +03:00
|
|
|
, configureCargoVendoredDepsHook
|
2021-12-27 05:06:19 +03:00
|
|
|
, copyCargoTargetToOutputHook
|
2021-12-27 03:18:22 +03:00
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
}:
|
|
|
|
|
2021-12-27 05:06:19 +03:00
|
|
|
{ doCopyTarget ? true
|
|
|
|
, doCopyTargetToSeparateOutput ? doCopyTarget
|
|
|
|
, nativeBuildInputs ? [ ]
|
|
|
|
, outputs ? [ "out" ]
|
|
|
|
, ...
|
|
|
|
}@args:
|
2021-12-27 03:18:22 +03:00
|
|
|
stdenv.mkDerivation (args // {
|
2021-12-27 05:06:19 +03:00
|
|
|
inherit
|
|
|
|
doCopyTarget
|
|
|
|
doCopyTargetToSeparateOutput;
|
|
|
|
|
2021-12-27 03:18:22 +03:00
|
|
|
nativeBuildInputs = nativeBuildInputs ++ [
|
|
|
|
cargo
|
2021-12-27 04:10:04 +03:00
|
|
|
configureCargoCommonVarsHook
|
2021-12-27 03:18:22 +03:00
|
|
|
configureCargoVendoredDepsHook
|
2021-12-27 05:06:19 +03:00
|
|
|
copyCargoTargetToOutputHook
|
2021-12-27 03:18:22 +03:00
|
|
|
];
|
|
|
|
|
2021-12-27 05:06:19 +03:00
|
|
|
outputs = outputs ++ lib.optional (doCopyTarget && doCopyTargetToSeparateOutput) "target";
|
|
|
|
|
2021-12-27 03:18:22 +03:00
|
|
|
buildPhase = ''
|
|
|
|
cargo check --release
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-12-27 05:06:19 +03:00
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out
|
|
|
|
runHook postInstall
|
2021-12-27 03:18:22 +03:00
|
|
|
'';
|
|
|
|
})
|