about summary refs log tree commit diff
path: root/pkgs/development/compilers/zig/generic.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/zig/generic.nix')
-rw-r--r--pkgs/development/compilers/zig/generic.nix10
1 files changed, 6 insertions, 4 deletions
diff --git a/pkgs/development/compilers/zig/generic.nix b/pkgs/development/compilers/zig/generic.nix
index cde1a61e3583..3da36c083bd3 100644
--- a/pkgs/development/compilers/zig/generic.nix
+++ b/pkgs/development/compilers/zig/generic.nix
@@ -41,12 +41,14 @@ stdenv.mkDerivation (finalAttrs: {
   # /System/Library/CoreServices/.SystemVersionPlatform.plist to determine the
   # OS version. This causes the build to fail during stage 3 with
   # OSVersionDetectionFail when the sandbox is enabled.
-  __impureHostDeps = lib.optionals stdenv.isDarwin [
+  __impureHostDeps = lib.optionals stdenv.hostPlatform.isDarwin [
     "/System/Library/CoreServices/.SystemVersionPlatform.plist"
     "/System/Library/CoreServices/SystemVersion.plist"
   ];
 
-  env.ZIG_GLOBAL_CACHE_DIR = "$TMPDIR/zig-cache";
+  preBuild = ''
+    export ZIG_GLOBAL_CACHE_DIR="$TMPDIR/zig-cache";
+  '';
 
   # Zig's build looks at /usr/bin/env to find dynamic linking info. This doesn't
   # work in Nix's sandbox. Use env from our coreutils instead.
@@ -55,14 +57,14 @@ stdenv.mkDerivation (finalAttrs: {
       --replace "/usr/bin/env" "${coreutils}/bin/env"
   '' else ''
     substituteInPlace lib/std/zig/system/NativeTargetInfo.zig \
-      --replace "/usr/bin/env" "${coreutils}/bin/env"
+      --replace-fail "/usr/bin/env" "${coreutils}/bin/env"
   '';
 
   doInstallCheck = true;
   installCheckPhase = ''
     runHook preInstallCheck
 
-    $out/bin/zig test --cache-dir "$TMPDIR/zig-test-cache" -I $src/test $src/test/behavior.zig
+    $out/bin/zig test -I $src/test $src/test/behavior.zig
 
     runHook postInstallCheck
   '';