zig: fix build on Darwin with sandbox enabled
During stage 3 of compilation, Zig calls `std.zig.system.darwin.macos.detect`,
which parses /System/Library/CoreServices/.SystemVersionPlatform.plist and
/System/Library/CoreServices/SystemVersion.plist[^1] to determine the OS
version. These paths are inaccessible when the sandbox is enabled, which causes
the build to fail with `OSVersionDetectionFail`[^2]. Fix the build with the
relaxed sandbox option by adding these paths to `__impureHostDeps`.
[^1]: cd62005f19/lib/std/zig/system/darwin/macos.zig
[^2]: https://github.com/NixOS/nixpkgs/issues/287861#issuecomment-2148703491
This commit is contained in:
@@ -38,6 +38,16 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
llvm
|
||||
]);
|
||||
|
||||
# On Darwin, Zig calls std.zig.system.darwin.macos.detect during the build,
|
||||
# which parses /System/Library/CoreServices/SystemVersion.plist and
|
||||
# /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 [
|
||||
"/System/Library/CoreServices/.SystemVersionPlatform.plist"
|
||||
"/System/Library/CoreServices/SystemVersion.plist"
|
||||
];
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"doc"
|
||||
|
||||
@@ -38,6 +38,16 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
llvm
|
||||
]);
|
||||
|
||||
# On Darwin, Zig calls std.zig.system.darwin.macos.detect during the build,
|
||||
# which parses /System/Library/CoreServices/SystemVersion.plist and
|
||||
# /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 [
|
||||
"/System/Library/CoreServices/.SystemVersionPlatform.plist"
|
||||
"/System/Library/CoreServices/SystemVersion.plist"
|
||||
];
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"doc"
|
||||
|
||||
@@ -36,6 +36,16 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
llvm
|
||||
]);
|
||||
|
||||
# On Darwin, Zig calls std.zig.system.darwin.macos.detect during the build,
|
||||
# which parses /System/Library/CoreServices/SystemVersion.plist and
|
||||
# /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 [
|
||||
"/System/Library/CoreServices/.SystemVersionPlatform.plist"
|
||||
"/System/Library/CoreServices/SystemVersion.plist"
|
||||
];
|
||||
|
||||
env.ZIG_GLOBAL_CACHE_DIR = "$TMPDIR/zig-cache";
|
||||
|
||||
# Zig's build looks at /usr/bin/env to find dynamic linking info. This doesn't
|
||||
|
||||
Reference in New Issue
Block a user