Skip to content

Commit d119d47

Browse files
committed
Symlink to /usr/bin/xcrun so that xcrun binary
is usable during build (used for compiling Metal shaders) Fixes #6117
1 parent c47cf41 commit d119d47

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.devops/nix/package.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
config,
55
stdenv,
66
mkShell,
7+
runCommand,
78
cmake,
89
ninja,
910
pkg-config,
@@ -87,6 +88,12 @@ let
8788
]
8889
);
8990

91+
darwinSymlinks = runCommand "darwin-build-symlinks" {
92+
} ''
93+
mkdir -p $out/bin
94+
ln -s /usr/bin/xcrun $out/bin
95+
'';
96+
9097
# apple_sdk is supposed to choose sane defaults, no need to handle isAarch64
9198
# separately
9299
darwinBuildInputs =
@@ -157,6 +164,8 @@ effectiveStdenv.mkDerivation (
157164
substituteInPlace ./*.py --replace "/usr/bin/env python" "${llama-python}/bin/python"
158165
'';
159166

167+
__impureHostDeps = optionals (effectiveStdenv.isDarwin && useMetalKit) [ "/usr/bin/xcrun" ];
168+
160169
nativeBuildInputs =
161170
[
162171
cmake
@@ -173,6 +182,8 @@ effectiveStdenv.mkDerivation (
173182
]
174183
++ optionals (effectiveStdenv.hostPlatform.isGnu && enableStatic) [
175184
glibc.static
185+
] ++ optionals (effectiveStdenv.isDarwin && useMetalKit) [
186+
darwinSymlinks
176187
];
177188

178189
buildInputs =

0 commit comments

Comments
 (0)