add the right COREAUDIO_SDK_PATH fore coreaudio-sys

This commit is contained in:
Brian Hicks 2021-10-29 11:05:19 -05:00
parent 2980e195ce
commit 5ef5a364ba

View File

@ -77,4 +77,33 @@ in pkgs.mkShell {
LD_LIBRARY_PATH = with pkgs;
lib.makeLibraryPath
([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ] ++ linuxInputs);
COREAUDIO_SDK_PATH = if pkgs.stdenv.isDarwin then
# The coreaudio-sys crate is configured to look for things in whatever the
# output of `xcrun --sdk macosx --show-sdk-path` is. However, this does not
# always contain the right frameworks, and it uses system versions instead of
# what we control via Nix. Instead of having to run a lot of extra scripts
# to set our systems up to build, we can just create a SDK directory with
# the same layout as the `MacOSX{version}.sdk` that XCode produces.
pkgs.symlinkJoin {
name = "sdk";
paths = with pkgs.darwin.apple_sdk.frameworks; [
AudioToolbox
AudioUnit
CoreAudio
CoreFoundation
CoreMIDI
OpenAL
];
postBuild = ''
mkdir $out/System
mv $out/Library $out/System
'';
}
else
# TODO: I'm not 100% confident that this being blank won't cause issues for
# Nix-on-Linux development. It may be sufficient to use the pkgs.symlinkJoin
# above regardless of system! That'd set us up for cross-compilation as well.
"";
}