status-mobile/nix/mobile/android/default.nix

46 lines
1.9 KiB
Nix
Raw Normal View History

2019-08-14 07:05:32 +00:00
{ config, stdenv, stdenvNoCC, target-os ? "android", callPackage, mkShell,
mkFilter, androidenv, fetchurl, openjdk, nodejs, bash, maven, zlib,
status-go, localMavenRepoBuilder, projectNodePackage, jsbundle }:
let
platform = callPackage ../../platform.nix { inherit target-os; };
androidEnv = callPackage ./android-env.nix { inherit target-os openjdk; };
gradle = callPackage ./gradle.nix { };
2019-09-10 09:50:09 +00:00
# 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 stdenv stdenvNoCC gradle bash nodejs zlib localMavenRepoBuilder mkFilter projectNodePackage; };
# TARGETS
2019-09-10 09:50:09 +00:00
release = callPackage ./targets/release-android.nix { inherit target-os gradle mavenAndNpmDeps mkFilter nodejs jsbundle status-go zlib watchmanFactory; androidEnvShellHook = androidEnv.shellHook; };
generate-maven-and-npm-deps-shell = callPackage ./maven-and-npm-deps/maven/shell.nix { inherit mkShell gradle maven nodejs projectNodePackage status-go; androidEnvShellHook = androidEnv.shellHook; };
adb-shell = mkShell {
buildInputs = [ androidEnv.licensedAndroidEnv ];
inherit (androidEnv) shellHook;
};
in {
inherit (androidEnv) androidComposition;
buildInputs = assert platform.targetAndroid; [ mavenAndNpmDeps.deriv openjdk gradle ];
shellHook =
let
inherit (stdenv.lib) catAttrs concatStrings;
in ''
${concatStrings (catAttrs "shellHook" [ mavenAndNpmDeps androidEnv ])}
$STATUS_REACT_HOME/scripts/generate-keystore.sh
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh "${mavenAndNpmDeps.deriv}/project" || exit
'';
# TARGETS
inherit release generate-maven-and-npm-deps-shell;
adb = {
shell = adb-shell;
};
}