I have a Rust project that we build to many platforms, including mobile devices.
Use a flake based Nix dev shell for everything, and for most stuff we have Nix packages defined.
We used to use the following snippet to take care of xcode:
xcode-wrapper = stdenv.mkDerivation {
name = "xcode-wrapper-16";
buildCommand = ''
mkdir -p $out/bin
ln -s /usr/bin/ld $out/bin/ld
ln -s /usr/bin/clang $out/bin/clang
ln -s /usr/bin/xcodebuild $out/bin/xcodebuild
ln -s /usr/bin/xcrun $out/bin/xcrun
# Check if we have the xcodebuild version that we want
if [ -z "$($out/bin/xcodebuild -version | grep '15.0.1')" ] && [ -z "$($out/bin/xcodebuild -version | grep '16.')" ]
then
echo "xcodebuild version: either v15.0.1 or v16.0+ is required"
echo "run: \`just install-xcode\` to install Xcode.app from the CLI"
exit 1
fi
'';
};
and some env vars to bandaid some ld vs clang issue, and we just build to iOS in the dev shell. I’m trying to switch it to:
xcodeenv = import "${nixpkgs}/pkgs/development/mobile/xcodeenv" { inherit (pkgs) callPackage; };
plus
(xcodeenv.composeXcodeWrapper {
versions = [ ];
# versions = [ "16.0" ];
xcodeBaseDir = "/Applications/Xcode-16.app";
})
nativeBuildInput
hoping to use something more standard, and maybe try to package our build in Nix derivations, etc.
This almost works, but I’m hitting problems and since I’m not even a MacOS user, I have tried hard but still don’t fully grok the issues I’m hitting.
WIth just the above plain seutp, the ring
build complains that it can’t find iossimulator, and indeed the SDK that is being pointed at, does not seem to contain it. And I do not know how to add - I don’t see any package like that.
I was able to set DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
and that seems to work, but … am I holding this right? Did I miss any documentation about adding components to the SDK?