nix: fix maven deps shell

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-05-06 00:48:50 +02:00
parent 68fcc967a7
commit fedb7131a9
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 58 additions and 52 deletions

View File

@ -1,46 +1,48 @@
{ config, lib, callPackage, mkShell, flock, lsof, openjdk, gradle_5, { lib, pkgs, newScope, mkShell
status-go, localMavenRepoBuilder, projectNodePackage, androidPkgs, androidShell }: , status-go, localMavenRepoBuilder, projectNodePackage
, gradle, androidPkgs, androidShell }:
let let
gradle = gradle_5; # Currently 5.6.4 callPackage = newScope { inherit localMavenRepoBuilder projectNodePackage; };
clojureDeps = import ../../deps/clojure/deps.nix { }; clojureDeps = import ../../deps/clojure/deps.nix { };
# Import a jsbundle compiled out of clojure codebase # Import a jsbundle compiled out of clojure codebase
jsbundle = callPackage ./jsbundle { jsbundle = callPackage ./jsbundle { inherit clojureDeps; };
inherit clojureDeps localMavenRepoBuilder projectNodePackage;
};
# Import a patched version of watchman (important for sandboxed builds on macOS) # Import a patched version of watchman (important for sandboxed builds on macOS)
watchmanFactory = callPackage ./watchman.nix { }; watchmanFactory = callPackage ./watchman.nix { };
# Import a local patched version of node_modules, together with a local version of the Maven repo # Import a local patched version of node_modules, together with a local version of the Maven repo
mavenAndNpmDeps = callPackage ./maven-and-npm-deps { mavenAndNpmDeps = callPackage ./maven-and-npm-deps { };
inherit gradle localMavenRepoBuilder projectNodePackage;
};
# TARGETS # TARGETS
release = callPackage ./targets/release-android.nix { 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 { generate-maven-and-npm-deps-shell = callPackage ./maven-and-npm-deps/maven/shell.nix {
inherit gradle projectNodePackage status-go; inherit status-go;
}; };
buildInputs = [ in {
# TARGETS
inherit release jsbundle generate-maven-and-npm-deps-shell;
shell = mkShell {
buildInputs = with pkgs; [
mavenAndNpmDeps.drv openjdk gradle mavenAndNpmDeps.drv openjdk gradle
lsof # used in start-react-native.sh lsof # used in start-react-native.sh
flock # used in reset-node_modules.sh flock # used in reset-node_modules.sh
]; ];
in { inputsFrom = [
# TARGETS gradle
inherit release jsbundle generate-maven-and-npm-deps-shell buildInputs; release
mavenAndNpmDeps.shell
androidShell
];
shell = lib.mergeSh
(mkShell {
inherit buildInputs;
inputsFrom = [ release gradle ];
shellHook = '' shellHook = ''
export ANDROID_SDK_ROOT="${androidPkgs}" export ANDROID_SDK_ROOT="${androidPkgs}"
export ANDROID_NDK_ROOT="${androidPkgs}/ndk-bundle" export ANDROID_NDK_ROOT="${androidPkgs}/ndk-bundle"
@ -52,6 +54,5 @@ in {
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh \ $STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh \
"${mavenAndNpmDeps.drv}/project" "${mavenAndNpmDeps.drv}/project"
''; '';
}) };
[ mavenAndNpmDeps.shell androidShell ];
} }

View File

@ -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; [ buildInputs = with pkgs; [
curl flock # used in reset-node_modules.sh curl flock # used in reset-node_modules.sh
git gradle jq maven nodejs git gradle jq maven nodejs
projectNodePackage projectNodePackage
]; ];
inputsFrom = [ androidShell ];
shellHook = '' 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_REACT_HOME/nix/mobile/reset-node_modules.sh "${projectNodePackage}"
''; '';
}) [ status-go.shell androidShell ] }

View File

@ -29,9 +29,9 @@ let
]; ];
in { in {
buildInputs = unique (catAttrs "buildInputs" selectedSources); shell = mkShell {
inputsFrom = (catAttrs "shell" selectedSources);
shell = lib.mergeSh (mkShell {}) (catAttrs "shell" selectedSources); };
# TARGETS # TARGETS
inherit android ios fastlane; inherit android ios fastlane;

View File

@ -8,14 +8,21 @@ let
pod-shell = callPackage ./pod-shell.nix { }; pod-shell = callPackage ./pod-shell.nix { };
status-go-shell = callPackage ./status-go-shell.nix { inherit status-go; }; status-go-shell = callPackage ./status-go-shell.nix { inherit status-go; };
selectedSources = [ status-go fastlane ]; in {
inherit pod-shell status-go-shell;
buildInputs = unique ([ shell = mkShell {
buildInputs = [
xcodeWrapper watchman bundler procps xcodeWrapper watchman bundler procps
flock # used in reset-node_modules.sh flock # used in reset-node_modules.sh
] ++ catAttrs "buildInputs" selectedSources); ];
inputsFrom = [
fastlane.shell
status-go-shell
pod-shell
];
localShell = mkShell {
shellHook = '' shellHook = ''
pushd "$STATUS_REACT_HOME" > /dev/null pushd "$STATUS_REACT_HOME" > /dev/null
{ {
@ -29,13 +36,6 @@ let
} }
popd > /dev/null popd > /dev/null
''; '';
inherit buildInputs;
}; };
in {
inherit buildInputs pod-shell status-go-shell;
shell = lib.mergeSh localShell [
fastlane.shell status-go-shell pod-shell
];
} }