mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
zig: move ZIG_GLOBAL_CACHE_DIR setup to configurePhase
This allows users to put zig in their `mkShell` without ending up with a ZIG_GLOBAL_CACHE_DIR value set that points back to a location that only would exist in the sandbox.
This commit is contained in:
@@ -32,6 +32,10 @@ stdenv.mkDerivation {
|
||||
|
||||
The variables below are exclusive to `zig`.
|
||||
|
||||
#### `dontUseZigConfigure` {#dont-use-zig-configure}
|
||||
|
||||
Disables using `zigConfigurePhase`.
|
||||
|
||||
#### `dontUseZigBuild` {#dont-use-zig-build}
|
||||
|
||||
Disables using `zigBuildPhase`.
|
||||
|
||||
@@ -2762,6 +2762,9 @@
|
||||
"index.html#zig-exclusive-variables",
|
||||
"index.html#zig-hook-exclusive-variables"
|
||||
],
|
||||
"dont-use-zig-configure": [
|
||||
"index.html#dont-use-zig-configure"
|
||||
],
|
||||
"dont-use-zig-build": [
|
||||
"index.html#dont-use-zig-build"
|
||||
],
|
||||
|
||||
@@ -4,9 +4,13 @@
|
||||
readonly zigDefaultCpuFlag=@zig_default_cpu_flag@
|
||||
readonly zigDefaultOptimizeFlag=@zig_default_optimize_flag@
|
||||
|
||||
function zigSetGlobalCacheDir {
|
||||
function zigConfigurePhase {
|
||||
runHook preConfigure
|
||||
|
||||
ZIG_GLOBAL_CACHE_DIR=$(mktemp -d)
|
||||
export ZIG_GLOBAL_CACHE_DIR
|
||||
|
||||
runHook postConfigure
|
||||
}
|
||||
|
||||
function zigBuildPhase {
|
||||
@@ -97,8 +101,9 @@ function zigInstallPhase {
|
||||
runHook postInstall
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
addEnvHooks "$hostOffset" zigSetGlobalCacheDir
|
||||
if [ -z "${dontUseZigConfigure-}" ] && [ -z "${configurePhase-}" ]; then
|
||||
configurePhase=zigConfigurePhase
|
||||
fi
|
||||
|
||||
if [ -z "${dontUseZigBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||
buildPhase=zigBuildPhase
|
||||
|
||||
Reference in New Issue
Block a user