mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-26 09:08:57 +03:00
c10fd1c8b1
* This will define CARGO_HOME to $PWD/.cargo-home to ensure that cargo never tries to look for a missing HOME directory as it's default location * The hook is also added to `postPatchHooks` (instead of `preConfigureHooks`) to ensure that it runs before all other configuration-related hooks
21 lines
860 B
Bash
21 lines
860 B
Bash
configureCargoCommonVars() {
|
|
echo "Executing configureCargoCommonVars"
|
|
|
|
# Set a CARGO_HOME if it doesn't exist so cargo does not go
|
|
# looking for a non-existent HOME directory
|
|
export CARGO_HOME=${CARGO_HOME:-${PWD}/.cargo-home}
|
|
mkdir -p ${CARGO_HOME}
|
|
|
|
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}
|
|
}
|
|
|
|
# NB: run after patching, but before other configure hooks so that we can set
|
|
# any default values as early in the process as possible.
|
|
postPatchHooks+=(configureCargoCommonVars)
|