mirror of
https://github.com/status-im/status-react.git
synced 2025-01-12 03:54:32 +00:00
Jakub Sokołowski
2f988fcd47
Otherwise we see weird errors like this: ``` /nix/store/g0jijpgcb4q54zbvz5p8yvxcnb6lshnk-stdenv-darwin/setup: line 1391: /nix/store/sja8sqq4y5s9ijkb97i3pi2jrhsy40cz-xcode-wrapper-14.3/bin/xcodebuild: Operation not permitted We require xcodebuild version: 14.3 error: builder for '/nix/store/d1dji0ywl851wgj9vv58ibpm32gq3wsm-xcode-wrapper-14.3.drv' failed with exit code 1; last 2 log lines: > /nix/store/g0jijpgcb4q54zbvz5p8yvxcnb6lshnk-stdenv-darwin/setup: line 1391: /nix/store/sja8sqq4y5s9ijkb97i3pi2jrhsy40cz-xcode-wrapper-14.3/bin/xcodebuild: Operation not permitted > We require xcodebuild version: 14.3 ``` Related to: https://github.com/NixOS/nixpkgs/pull/228696 Signed-off-by: Jakub Sokołowski <jakub@status.im>
45 lines
1.4 KiB
Nix
45 lines
1.4 KiB
Nix
{ stdenv }:
|
|
|
|
{ version ? "11.1"
|
|
, allowHigher ? false
|
|
, xcodeBaseDir ? "/Applications/Xcode.app" }:
|
|
|
|
assert stdenv.isDarwin;
|
|
|
|
stdenv.mkDerivation {
|
|
name = "xcode-wrapper-${version}${if allowHigher then "-plus" else ""}";
|
|
# Fix 'xcodebuild: Operation not permitted' when 'sandbox=relaxed' is used.
|
|
# https://github.com/NixOS/nixpkgs/pull/228696
|
|
__noChroot = stdenv.isDarwin;
|
|
buildCommand = ''
|
|
mkdir -p $out/bin
|
|
cd $out/bin
|
|
ln -s /usr/bin/xcode-select
|
|
ln -s /usr/bin/security
|
|
ln -s /usr/bin/codesign
|
|
ln -s /usr/bin/xcrun
|
|
ln -s /usr/bin/plutil
|
|
ln -s /usr/bin/clang
|
|
ln -s /usr/bin/lipo
|
|
ln -s /usr/bin/file
|
|
ln -s /usr/bin/rev
|
|
ln -s "${xcodeBaseDir}/Contents/Developer/usr/bin/xcodebuild"
|
|
ln -s "${xcodeBaseDir}/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator"
|
|
|
|
cd ..
|
|
ln -s "${xcodeBaseDir}/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs"
|
|
|
|
# Check if we have the xcodebuild version that we want
|
|
currVer=$($out/bin/xcodebuild -version)
|
|
${if allowHigher then ''
|
|
if [ -z "$(printf '%s\n' "${version}" "$currVer" | sort -V | head -n1)""" != "${version}" ]
|
|
'' else ''
|
|
if [ -z "$(echo $currVer | grep -x 'Xcode ${version}')" ]
|
|
''}
|
|
then
|
|
echo "We require xcodebuild version${if allowHigher then " or higher" else ""}: ${version}"
|
|
exit 1
|
|
fi
|
|
'';
|
|
}
|