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,57 +1,58 @@
{ 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 = [
mavenAndNpmDeps.drv openjdk gradle
lsof # used in start-react-native.sh
flock # used in reset-node_modules.sh
];
in { in {
# TARGETS # TARGETS
inherit release jsbundle generate-maven-and-npm-deps-shell buildInputs; inherit release jsbundle generate-maven-and-npm-deps-shell;
shell = lib.mergeSh shell = mkShell {
(mkShell { buildInputs = with pkgs; [
inherit buildInputs; mavenAndNpmDeps.drv openjdk gradle
inputsFrom = [ release gradle ]; lsof # used in start-react-native.sh
shellHook = '' flock # used in reset-node_modules.sh
export ANDROID_SDK_ROOT="${androidPkgs}" ];
export ANDROID_NDK_ROOT="${androidPkgs}/ndk-bundle"
# required by some makefile targets inputsFrom = [
export STATUS_GO_ANDROID_LIBDIR=${status-go} gradle
release
mavenAndNpmDeps.shell
androidShell
];
# check if node modules changed and if so install them shellHook = ''
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh \ export ANDROID_SDK_ROOT="${androidPkgs}"
"${mavenAndNpmDeps.drv}/project" export ANDROID_NDK_ROOT="${androidPkgs}/ndk-bundle"
'';
}) # required by some makefile targets
[ mavenAndNpmDeps.shell androidShell ]; 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"
'';
};
} }

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 {
xcodeWrapper watchman bundler procps buildInputs = [
flock # used in reset-node_modules.sh xcodeWrapper watchman bundler procps
] ++ catAttrs "buildInputs" selectedSources); flock # used in reset-node_modules.sh
];
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
];
} }