From fedb7131a967061e1ed02b76d3ff5b6d502c92ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 6 May 2020 00:48:50 +0200 Subject: [PATCH] nix: fix maven deps shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- nix/mobile/android/default.nix | 67 ++++++++++--------- .../maven-and-npm-deps/maven/shell.nix | 11 ++- nix/mobile/default.nix | 6 +- nix/mobile/ios/default.nix | 26 +++---- 4 files changed, 58 insertions(+), 52 deletions(-) diff --git a/nix/mobile/android/default.nix b/nix/mobile/android/default.nix index 399769b9e3..cd8585c351 100644 --- a/nix/mobile/android/default.nix +++ b/nix/mobile/android/default.nix @@ -1,57 +1,58 @@ -{ config, lib, callPackage, mkShell, flock, lsof, openjdk, gradle_5, - status-go, localMavenRepoBuilder, projectNodePackage, androidPkgs, androidShell }: +{ lib, pkgs, newScope, mkShell +, status-go, localMavenRepoBuilder, projectNodePackage +, gradle, androidPkgs, androidShell }: let - gradle = gradle_5; # Currently 5.6.4 + callPackage = newScope { inherit localMavenRepoBuilder projectNodePackage; }; + clojureDeps = import ../../deps/clojure/deps.nix { }; # Import a jsbundle compiled out of clojure codebase - jsbundle = callPackage ./jsbundle { - inherit clojureDeps localMavenRepoBuilder projectNodePackage; - }; + jsbundle = callPackage ./jsbundle { inherit clojureDeps; }; # Import a patched version of watchman (important for sandboxed builds on macOS) watchmanFactory = callPackage ./watchman.nix { }; # Import a local patched version of node_modules, together with a local version of the Maven repo - mavenAndNpmDeps = callPackage ./maven-and-npm-deps { - inherit gradle localMavenRepoBuilder projectNodePackage; - }; + mavenAndNpmDeps = callPackage ./maven-and-npm-deps { }; # TARGETS release = callPackage ./targets/release-android.nix { - inherit config gradle mavenAndNpmDeps jsbundle status-go watchmanFactory; + inherit gradle mavenAndNpmDeps jsbundle status-go watchmanFactory; }; generate-maven-and-npm-deps-shell = callPackage ./maven-and-npm-deps/maven/shell.nix { - inherit gradle projectNodePackage status-go; + inherit status-go; }; - buildInputs = [ - mavenAndNpmDeps.drv openjdk gradle - lsof # used in start-react-native.sh - flock # used in reset-node_modules.sh - ]; - in { # TARGETS - inherit release jsbundle generate-maven-and-npm-deps-shell buildInputs; + inherit release jsbundle generate-maven-and-npm-deps-shell; - shell = lib.mergeSh - (mkShell { - inherit buildInputs; - inputsFrom = [ release gradle ]; - shellHook = '' - export ANDROID_SDK_ROOT="${androidPkgs}" - export ANDROID_NDK_ROOT="${androidPkgs}/ndk-bundle" + shell = mkShell { + buildInputs = with pkgs; [ + mavenAndNpmDeps.drv openjdk gradle + lsof # used in start-react-native.sh + flock # used in reset-node_modules.sh + ]; - # required by some makefile targets - export STATUS_GO_ANDROID_LIBDIR=${status-go} + inputsFrom = [ + gradle + release + mavenAndNpmDeps.shell + androidShell + ]; - # check if node modules changed and if so install them - $STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh \ - "${mavenAndNpmDeps.drv}/project" - ''; - }) - [ mavenAndNpmDeps.shell androidShell ]; + shellHook = '' + export ANDROID_SDK_ROOT="${androidPkgs}" + export ANDROID_NDK_ROOT="${androidPkgs}/ndk-bundle" + + # required by some makefile targets + export STATUS_GO_ANDROID_LIBDIR=${status-go} + + # check if node modules changed and if so install them + $STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh \ + "${mavenAndNpmDeps.drv}/project" + ''; + }; } diff --git a/nix/mobile/android/maven-and-npm-deps/maven/shell.nix b/nix/mobile/android/maven-and-npm-deps/maven/shell.nix index d7cf5c82f2..74cc71513f 100644 --- a/nix/mobile/android/maven-and-npm-deps/maven/shell.nix +++ b/nix/mobile/android/maven-and-npm-deps/maven/shell.nix @@ -1,12 +1,17 @@ -{ lib, mkShell, pkgs, gradle, projectNodePackage, androidShell, status-go }: +{ mkShell, pkgs +, projectNodePackage, androidShell, status-go }: -lib.mergeSh (mkShell { +mkShell { buildInputs = with pkgs; [ curl flock # used in reset-node_modules.sh git gradle jq maven nodejs projectNodePackage ]; + inputsFrom = [ androidShell ]; shellHook = '' + # Gradle check for this being set + export STATUS_GO_ANDROID_LIBDIR=${status-go} + $STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh "${projectNodePackage}" ''; -}) [ status-go.shell androidShell ] +} diff --git a/nix/mobile/default.nix b/nix/mobile/default.nix index e5f958f28f..1760f5d3a7 100644 --- a/nix/mobile/default.nix +++ b/nix/mobile/default.nix @@ -29,9 +29,9 @@ let ]; in { - buildInputs = unique (catAttrs "buildInputs" selectedSources); - - shell = lib.mergeSh (mkShell {}) (catAttrs "shell" selectedSources); + shell = mkShell { + inputsFrom = (catAttrs "shell" selectedSources); + }; # TARGETS inherit android ios fastlane; diff --git a/nix/mobile/ios/default.nix b/nix/mobile/ios/default.nix index bc8d45a825..f97250ff16 100644 --- a/nix/mobile/ios/default.nix +++ b/nix/mobile/ios/default.nix @@ -8,14 +8,21 @@ let pod-shell = callPackage ./pod-shell.nix { }; status-go-shell = callPackage ./status-go-shell.nix { inherit status-go; }; - selectedSources = [ status-go fastlane ]; +in { + inherit pod-shell status-go-shell; - buildInputs = unique ([ - xcodeWrapper watchman bundler procps - flock # used in reset-node_modules.sh - ] ++ catAttrs "buildInputs" selectedSources); + shell = mkShell { + buildInputs = [ + xcodeWrapper watchman bundler procps + flock # used in reset-node_modules.sh + ]; + + inputsFrom = [ + fastlane.shell + status-go-shell + pod-shell + ]; - localShell = mkShell { shellHook = '' pushd "$STATUS_REACT_HOME" > /dev/null { @@ -29,13 +36,6 @@ let } popd > /dev/null ''; - inherit buildInputs; }; -in { - inherit buildInputs pod-shell status-go-shell; - - shell = lib.mergeSh localShell [ - fastlane.shell status-go-shell pod-shell - ]; }