diff --git a/pkgs/development/mobile/xcodeenv/build-app.nix b/pkgs/development/mobile/xcodeenv/build-app.nix index 90fa307fbf2..b88f806d586 100644 --- a/pkgs/development/mobile/xcodeenv/build-app.nix +++ b/pkgs/development/mobile/xcodeenv/build-app.nix @@ -1,7 +1,7 @@ {stdenv, composeXcodeWrapper}: { name , src -, sdkVersion ? "11.3" +, sdkVersion ? "12.1" , target ? null , configuration ? null , scheme ? null @@ -11,6 +11,7 @@ , certificateFile ? null , certificatePassword ? null , provisioningProfile ? null +, codeSignIdentity ? null , signMethod ? null , generateIPA ? false , generateXCArchive ? false @@ -21,7 +22,7 @@ , ... }@args: -assert release -> certificateFile != null && certificatePassword != null && provisioningProfile != null && signMethod != null; +assert release -> certificateFile != null && certificatePassword != null && provisioningProfile != null && signMethod != null && codeSignIdentity != null; assert enableWirelessDistribution -> installURL != null && bundleId != null && appVersion != null; let @@ -53,8 +54,11 @@ let in stdenv.mkDerivation ({ name = stdenv.lib.replaceChars [" "] [""] name; # iOS app names can contain spaces, but in the Nix store this is not allowed - buildInputs = [ xcodewrapper ]; buildPhase = '' + # Be sure that the Xcode wrapper has priority over everything else. + # When using buildInputs this does not seem to be the case. + export PATH=${xcodewrapper}/bin:$PATH + ${stdenv.lib.optionalString release '' export HOME=/Users/$(whoami) keychainName="$(basename $out)" @@ -85,9 +89,9 @@ stdenv.mkDerivation ({ ''} # Do the building - export LD=clang # To avoid problem with -isysroot parameter that is unrecognized by the stock ld. Comparison with an impure build shows that it uses clang instead. Ugly, but it works + export LD=/usr/bin/clang # To avoid problem with -isysroot parameter that is unrecognized by the stock ld. Comparison with an impure build shows that it uses clang instead. Ugly, but it works - xcodebuild -target ${_target} -configuration ${_configuration} ${stdenv.lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${if generateIPA || generateXCArchive then "-archivePath \"${name}.xcarchive\" archive" else ""} ${if release then ''PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"'' else ""} ${xcodeFlags} + xcodebuild -target ${_target} -configuration ${_configuration} ${stdenv.lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${if generateIPA || generateXCArchive then "-archivePath \"${name}.xcarchive\" archive" else ""} ${if release then '' PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"'' else ""} ${xcodeFlags} ${stdenv.lib.optionalString release '' ${stdenv.lib.optionalString generateIPA '' @@ -97,11 +101,15 @@ stdenv.mkDerivation ({ + signingCertificate + ${codeSignIdentity} provisioningProfiles - ${bundleId} + ${stdenv.lib.toLower bundleId} $PROVISIONING_PROFILE + signingStyle + manual method ${signMethod} ${stdenv.lib.optionalString (signMethod == "enterprise" || signMethod == "ad-hoc") '' diff --git a/pkgs/development/mobile/xcodeenv/compose-xcodewrapper.nix b/pkgs/development/mobile/xcodeenv/compose-xcodewrapper.nix index d0093ffac91..dea1b77211b 100644 --- a/pkgs/development/mobile/xcodeenv/compose-xcodewrapper.nix +++ b/pkgs/development/mobile/xcodeenv/compose-xcodewrapper.nix @@ -1,5 +1,5 @@ {stdenv}: -{version ? "9.3", xcodeBaseDir ? "/Applications/Xcode.app"}: +{version ? "10.1", xcodeBaseDir ? "/Applications/Xcode.app"}: assert stdenv.isDarwin; @@ -13,6 +13,7 @@ stdenv.mkDerivation { ln -s /usr/bin/codesign ln -s /usr/bin/xcrun ln -s /usr/bin/plutil + ln -s /usr/bin/clang ln -s "${xcodeBaseDir}/Contents/Developer/usr/bin/xcodebuild" ln -s "${xcodeBaseDir}/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator"