Skip to content

Commit

Permalink
Symlink to /usr/bin/xcrun so that xcrun binary
Browse files Browse the repository at this point in the history
is usable during build (used for compiling Metal shaders)

Fixes #6117
  • Loading branch information
josephst committed Mar 19, 2024
1 parent c47cf41 commit d119d47
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .devops/nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
config,
stdenv,
mkShell,
runCommand,
cmake,
ninja,
pkg-config,
Expand Down Expand Up @@ -87,6 +88,12 @@ let
]
);

darwinSymlinks = runCommand "darwin-build-symlinks" {
} ''
mkdir -p $out/bin
ln -s /usr/bin/xcrun $out/bin
'';

# apple_sdk is supposed to choose sane defaults, no need to handle isAarch64
# separately
darwinBuildInputs =
Expand Down Expand Up @@ -157,6 +164,8 @@ effectiveStdenv.mkDerivation (
substituteInPlace ./*.py --replace "/usr/bin/env python" "${llama-python}/bin/python"
'';

__impureHostDeps = optionals (effectiveStdenv.isDarwin && useMetalKit) [ "/usr/bin/xcrun" ];

nativeBuildInputs =
[
cmake
Expand All @@ -173,6 +182,8 @@ effectiveStdenv.mkDerivation (
]
++ optionals (effectiveStdenv.hostPlatform.isGnu && enableStatic) [
glibc.static
] ++ optionals (effectiveStdenv.isDarwin && useMetalKit) [
darwinSymlinks
];

buildInputs =
Expand Down

0 comments on commit d119d47

Please sign in to comment.