nix: fix order of iOS shell components

Possible fix for errors like:
```
bundler: failed to load command: fastlane (/Users/jenkins/.bundle/ruby/2.7.0/bin/fastlane)
/Users/jenkins/.bundle/ruby/2.7.0/gems/fastlane-2.205.2/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in `shell_error!': [!] Shell command exited with exit status 51 instead of 0. (FastlaneCore::Interface::FastlaneShellError)
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-08-29 18:26:14 +02:00
parent badf72af9f
commit ca8b721135
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
6 changed files with 45 additions and 21 deletions

View File

@ -1,14 +1,15 @@
{ callPackage, lib, mkShell, deps, pkgs
{ callPackage, lib, mkShell, pkgs
, status-go, fastlane }:
let
inherit (lib) catAttrs unique;
pod-shell = callPackage ./pod-shell.nix { };
status-go-shell = callPackage ./status-go-shell.nix { inherit status-go; };
nodejs-sh = callPackage ./shells/nodejs.nix { };
cocoapods-sh = callPackage ./shells/pod.nix { };
status-go-sh = callPackage ./shells/status-go.nix { inherit status-go; };
in {
inherit pod-shell status-go-shell;
inherit nodejs-sh cocoapods-sh status-go-sh;
shell = mkShell {
buildInputs = with pkgs; [
@ -19,14 +20,9 @@ in {
# WARNING: Executes shellHook in reverse order.
inputsFrom = [
fastlane.shell
pod-shell
status-go-shell # Needs to run before pod-install
cocoapods-sh
nodejs-sh # before 'pod install'
status-go-sh # before 'pod install'
];
shellHook = ''
# check if node modules changed and if so install them
./nix/scripts/node_modules.sh "${deps.nodejs-patched}"
'';
};
}

View File

@ -0,0 +1,9 @@
{ mkShell, deps }:
mkShell {
# check if node modules changed and if so install them
shellHook = ''
export STATUS_MOBILE_HOME=$(git rev-parse --show-toplevel)
"$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh" ${deps.nodejs-patched}
'';
}

View File

@ -0,0 +1,24 @@
{ mkShell, cocoapods }:
let
# source of what pod should install
podfileLock = "ios/Podfile.lock";
# current state of pods installed by pod
manifestLock = "ios/Pods/Manifest.lock";
in mkShell {
buildInputs = [ cocoapods ];
shellHook = ''
pushd "$STATUS_MOBILE_HOME" > /dev/null
{
echo "Checking for modifications in ios/Pods..."
if diff -q ${podfileLock} ${manifestLock}; then
echo "No modifications detected."
else
# CocoaPods are trash and can't handle other pod instances running
./scripts/wait-for.sh 240 'pod install'
(cd ios && pod install)
fi
}
popd > /dev/null
'';
}

View File

@ -13,23 +13,18 @@ let
default = callPackage ./shell.nix { };
# Combines with many other shells
node-sh = mkShell {
shellHook = ''
export STATUS_MOBILE_HOME=$(git rev-parse --show-toplevel)
"$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh" ${pkgs.deps.nodejs-patched}
'';
};
nodejs-sh = targets.mobile.ios.nodejs-sh;
# An attrset for easier merging with default shell
shells = {
inherit default;
nodejs = node-sh;
nodejs = nodejs-sh;
# for calling clojure targets in CI or Makefile
clojure = mkShell {
buildInputs = with pkgs; [ clojure flock maven openjdk ];
inputsFrom = [ node-sh ];
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"
@ -47,7 +42,7 @@ let
# for running gradle by hand
gradle = mkShell {
buildInputs = with pkgs; [ gradle maven goMavenResolver ];
inputsFrom = [ node-sh ];
inputsFrom = [ nodejs-sh ];
shellHook = ''
export STATUS_GO_ANDROID_LIBDIR="DUMMY"
export STATUS_NIX_MAVEN_REPO="${pkgs.deps.gradle}"