2019-06-04 16:50:29 +00:00
|
|
|
#
|
|
|
|
# This Nix expression centralizes the configuration for the Android development environment
|
|
|
|
#
|
|
|
|
|
2019-11-29 10:20:08 +00:00
|
|
|
{ stdenv, config, callPackage, androidenv, openjdk, mkShell }:
|
2019-06-04 16:50:29 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
androidComposition = androidenv.composeAndroidPackages {
|
|
|
|
toolsVersion = "26.1.1";
|
2020-04-15 11:12:56 +00:00
|
|
|
platformToolsVersion = "29.0.6";
|
2019-11-20 12:42:41 +00:00
|
|
|
buildToolsVersions = [ "29.0.2" ];
|
2019-06-04 16:50:29 +00:00
|
|
|
includeEmulator = false;
|
2019-11-20 12:42:41 +00:00
|
|
|
platformVersions = [ "29" ];
|
2019-06-04 16:50:29 +00:00
|
|
|
includeSources = false;
|
|
|
|
includeDocs = false;
|
|
|
|
includeSystemImages = false;
|
|
|
|
systemImageTypes = [ "default" ];
|
2019-11-20 12:42:41 +00:00
|
|
|
lldbVersions = [ "3.1.4508709" ];
|
|
|
|
cmakeVersions = [ "3.10.2" ];
|
2019-06-04 16:50:29 +00:00
|
|
|
includeNDK = true;
|
2020-01-22 13:43:31 +00:00
|
|
|
ndkVersion = "21.0.6113669";
|
2019-06-04 16:50:29 +00:00
|
|
|
useGoogleAPIs = false;
|
|
|
|
useGoogleTVAddOns = false;
|
|
|
|
includeExtras = [ "extras;android;m2repository" "extras;google;m2repository" ];
|
|
|
|
};
|
|
|
|
licensedAndroidEnv = stdenv.mkDerivation rec {
|
|
|
|
name = "licensed-android-sdk";
|
|
|
|
version = "licensed";
|
2019-11-29 10:20:08 +00:00
|
|
|
phases = [ "installPhase" "licensePhase" ];
|
2019-06-04 16:50:29 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/libexec/android-sdk
|
|
|
|
ln -s "${androidComposition.androidsdk}/bin" $out/bin
|
|
|
|
for d in ${androidComposition.androidsdk}/libexec/android-sdk/*; do
|
|
|
|
ln -s $d $out/$(basename $d)
|
|
|
|
done
|
2019-11-29 10:20:08 +00:00
|
|
|
'';
|
|
|
|
licensePhase = stdenv.lib.optionalString config.android_sdk.accept_license ''
|
2019-06-04 16:50:29 +00:00
|
|
|
mkdir -p $out/licenses
|
|
|
|
echo -e "\n601085b94cd77f0b54ff86406957099ebe79c4d6" > "$out/licenses/android-googletv-license"
|
|
|
|
echo -e "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$out/licenses/android-sdk-license"
|
|
|
|
echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$out/licenses/android-sdk-preview-license"
|
|
|
|
echo -e "\nd975f751698a77b662f1254ddbeed3901e976f5a" > "$out/licenses/intel-android-extra-license"
|
|
|
|
echo -e "\n33b6a2b64607f11b759f320ef9dff4ae5c47d97a" > "$out/licenses/google-gdk-license"
|
|
|
|
'';
|
|
|
|
};
|
2019-11-29 10:20:08 +00:00
|
|
|
shell = mkShell {
|
|
|
|
shellHook = ''
|
2019-07-29 08:33:35 +00:00
|
|
|
export JAVA_HOME="${openjdk}"
|
|
|
|
export ANDROID_HOME="${licensedAndroidEnv}"
|
|
|
|
export ANDROID_SDK_ROOT="$ANDROID_HOME"
|
|
|
|
export ANDROID_NDK_ROOT="${androidComposition.androidsdk}/libexec/android-sdk/ndk-bundle"
|
|
|
|
export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT"
|
|
|
|
export ANDROID_NDK="$ANDROID_NDK_ROOT"
|
|
|
|
export PATH="$ANDROID_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools:$PATH"
|
|
|
|
'';
|
2019-11-29 10:20:08 +00:00
|
|
|
};
|
2019-06-04 16:50:29 +00:00
|
|
|
|
|
|
|
in {
|
2019-11-29 10:20:08 +00:00
|
|
|
drv = licensedAndroidEnv;
|
|
|
|
inherit androidComposition shell;
|
2019-11-20 12:42:41 +00:00
|
|
|
}
|