From 08403df4c0ccb550314167e992ef4ddb4b149f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 16 Jan 2023 14:32:56 +0100 Subject: [PATCH] ci: use M1 Macs for iOS builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should be faster, and is the same a how we do it for mobile app. Signed-off-by: Jakub SokoĊ‚owski --- _assets/ci/Jenkinsfile.ios | 2 +- shell.nix | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/_assets/ci/Jenkinsfile.ios b/_assets/ci/Jenkinsfile.ios index 50b3e3766..0f2828277 100644 --- a/_assets/ci/Jenkinsfile.ios +++ b/_assets/ci/Jenkinsfile.ios @@ -1,7 +1,7 @@ library 'status-jenkins-lib@v1.6.4' pipeline { - agent { label 'macos && x86_64 && go-1.18' } + agent { label 'macos && aarch64 && go-1.18 && nix-2.11' } parameters { string( diff --git a/shell.nix b/shell.nix index 624923607..5b4c4fc8d 100644 --- a/shell.nix +++ b/shell.nix @@ -29,28 +29,35 @@ } }: -pkgs.mkShell { +let + inherit (pkgs) lib stdenv; + + /* No Android SDK for Darwin aarch64. */ + isMacM1 = stdenv.isDarwin && stdenv.isAarch64; + /* Lock requires Xcode verison. */ + xcodeWrapper = pkgs.xcodeenv.composeXcodeWrapper { version = "14.2"; }; + /* Gomobile also needs the Xcode wrapper. */ + gomobileMod = pkgs.gomobile.override { + inherit xcodeWrapper; + withAndroidPkgs = !isMacM1; + }; +in pkgs.mkShell { name = "status-go-shell"; buildInputs = with pkgs; [ git jq which - go_1_18 golangci-lint gopls go-bindata + go_1_18 golangci-lint gopls go-bindata gomobileMod mockgen protobuf3_17 protoc-gen-go - (gomobile.override { xcodeWrapperArgs = { version = "13.4.1"; }; }) - ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ - (xcodeenv.composeXcodeWrapper { version = "13.4.1"; }) - ]; + ] ++ lib.optional stdenv.isDarwin xcodeWrapper; - shellHook = let - androidSdk = pkgs.androidPkgs.androidsdk; - in '' - ANDROID_HOME=${androidSdk}/libexec/android-sdk + shellHook = lib.optionalString (!isMacM1) '' + ANDROID_HOME=${pkgs.androidPkgs.androidsdk}/libexec/android-sdk + ANDROID_NDK=$ANDROID_HOME/ndk-bundle ANDROID_SDK_ROOT=$ANDROID_HOME - ANDROID_NDK=${androidSdk}/libexec/android-sdk/ndk-bundle ANDROID_NDK_HOME=$ANDROID_NDK ''; # Sandbox causes Xcode issues on MacOS. Requires sandbox=relaxed. # https://github.com/status-im/status-mobile/pull/13912 - __noChroot = pkgs.stdenv.isDarwin; + __noChroot = stdenv.isDarwin; }