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,
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"
'';
};
}

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; [
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 ]
}

View File

@ -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;

View File

@ -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
];
}