From 3e8647d626004852428a856fdd78369975ae13f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 20 Apr 2023 12:36:48 +0200 Subject: [PATCH] nix: add ios-deploy package to ios shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also adds an assertion that gives a better error when trying to use an `ios` Nix shell on an unsupported operating system. Resolves: https://github.com/status-im/status-mobile/issues/15695 Signed-off-by: Jakub SokoĊ‚owski --- nix/mobile/ios/default.nix | 6 +++++- nix/mobile/ios/shells/nodejs.nix | 4 +--- nix/overlay.nix | 12 ++++++++++++ nix/shells.nix | 9 +++------ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/nix/mobile/ios/default.nix b/nix/mobile/ios/default.nix index 4022f2014a..59a07f6d49 100644 --- a/nix/mobile/ios/default.nix +++ b/nix/mobile/ios/default.nix @@ -1,6 +1,9 @@ -{ callPackage, lib, mkShell, pkgs +{ callPackage, lib, mkShell, pkgs, stdenv , status-go, fastlane }: +assert lib.assertMsg stdenv.isDarwin + "iOS development shell supported only on OSX."; + let inherit (lib) catAttrs unique; @@ -17,6 +20,7 @@ in { buildInputs = with pkgs; [ xcodeWrapper watchman procps flock # used in nix/scripts/node_modules.sh + ios-deploy # used in 'make run-ios-device' ]; # WARNING: Executes shellHook in reverse order. diff --git a/nix/mobile/ios/shells/nodejs.nix b/nix/mobile/ios/shells/nodejs.nix index 98c7930ac6..9526d63c0a 100644 --- a/nix/mobile/ios/shells/nodejs.nix +++ b/nix/mobile/ios/shells/nodejs.nix @@ -1,17 +1,15 @@ { mkShell, nodejs, deps }: mkShell { - # Check if node modules changed and if so install them. shellHook = '' # Fix for ERR_OSSL_EVP_UNSUPPORTED error. export NODE_OPTIONS="--openssl-legacy-provider"; # Same fix but for Xcode React Native script. export NODE_ARGS="--openssl-legacy-provider --max-old-space-size=16384"; - # Fix Xcode using system Node.js version. export NODE_BINARY="${nodejs}/bin/node"; - export STATUS_MOBILE_HOME=$(git rev-parse --show-toplevel) + # Check if node modules changed and if so install them. "$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh" ${deps.nodejs-patched} ''; } diff --git a/nix/overlay.nix b/nix/overlay.nix index cd53136315..09e3adb939 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -44,6 +44,18 @@ in { }); }; + # Fix for missing libarclite_macosx.a in Xcode 14.3. + # https://github.com/ios-control/ios-deploy/issues/580 + ios-deploy = super.darwin.ios-deploy.overrideAttrs (old: rec { + version = "1.12.2"; + src = super.fetchFromGitHub { + owner = "ios-control"; + repo = "ios-deploy"; + rev = version; + sha256 = "sha256-TVGC+f+1ow3b93CK3PhIL70le5SZxxb2ug5OkIg8XCA"; + }; + }); + # Package version adjustments gradle = super.gradle_6; nodejs = super.nodejs-18_x; diff --git a/nix/shells.nix b/nix/shells.nix index 205892c3f5..edb9400569 100644 --- a/nix/shells.nix +++ b/nix/shells.nix @@ -12,22 +12,19 @@ let # the default shell with most commonly used tools default = callPackage ./shell.nix { }; - # Combines with many other shells - nodejs-sh = targets.mobile.ios.nodejs-sh; - # An attrset for easier merging with default shell shells = { inherit default; - nodejs = nodejs-sh; - # for calling clojure targets in CI or Makefile clojure = mkShell { buildInputs = with pkgs; [ clojure flock maven openjdk ]; - inputsFrom = [ nodejs-sh ]; # CLASSPATH from clojure deps with 'src' appended to find local sources. shellHook = with pkgs; '' export CLASS_PATH="$(find ${deps.clojure} -iname '*.jar' | tr '\n' ':')src" + + # Check if node modules changed and if so install them. + "$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh" ${pkgs.deps.nodejs-patched} ''; };