mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-22 23:17:15 +03:00
Add configureCargoCommonVarsHook
This commit is contained in:
parent
e1b7cea23c
commit
c2d7d083d5
@ -1,4 +1,5 @@
|
||||
{ cargo
|
||||
, configureCargoCommonVarsHook
|
||||
, configureCargoVendoredDepsHook
|
||||
, lib
|
||||
, stdenv
|
||||
@ -8,6 +9,7 @@ args@{ nativeBuildInputs ? [ ], ... }:
|
||||
stdenv.mkDerivation (args // {
|
||||
nativeBuildInputs = nativeBuildInputs ++ [
|
||||
cargo
|
||||
configureCargoCommonVarsHook
|
||||
configureCargoVendoredDepsHook
|
||||
];
|
||||
|
||||
|
15
pkgs/configureCargoCommonVarsHook.sh
Normal file
15
pkgs/configureCargoCommonVarsHook.sh
Normal file
@ -0,0 +1,15 @@
|
||||
configureCargoCommonVars() {
|
||||
echo "Executing configureCargoCommonVars"
|
||||
|
||||
export CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-$NIX_BUILD_CORES}
|
||||
export RUST_TEST_THREADS=${RUST_TEST_THREADS:-$NIX_BUILD_CORES}
|
||||
|
||||
# Disable incremental builds by default since we don't get a ton of benefit
|
||||
# while building with nix. Allow a declared-but-empty variable which will tell
|
||||
# cargo to honor the definition used in the build profile
|
||||
export CARGO_BUILD_INCREMENTAL=${CARGO_BUILD_INCREMENTAL-false}
|
||||
|
||||
echo "Finished configureCargoCommonVars"
|
||||
}
|
||||
|
||||
preConfigureHooks+=(configureCargoCommonVars)
|
@ -1,6 +1,11 @@
|
||||
{ makeSetupHook }:
|
||||
|
||||
{
|
||||
configureCargoCommonVarsHook = makeSetupHook
|
||||
{
|
||||
name = "configureCargoCommonVarsHook";
|
||||
} ./configureCargoCommonVarsHook.sh;
|
||||
|
||||
configureCargoVendoredDepsHook = makeSetupHook
|
||||
{
|
||||
name = "configureCargoVendoredDepsHook";
|
||||
|
Loading…
Reference in New Issue
Block a user