1{
2 # If you want to use the in-tree version of nixpkgs:
3 pkgs ? import ../../../../.. {
4 config.allowUnfree = true;
5 },
6
7 licenseAccepted ? pkgs.callPackage ../license.nix { },
8}:
9
10# Tests IFD with androidenv. Needs a folder of `../xml` in your local tree;
11# use ../fetchrepo.sh to produce it.
12let
13 androidEnv = pkgs.callPackage ./.. {
14 inherit pkgs licenseAccepted;
15 };
16
17 sdkArgs = {
18 repoXmls = {
19 packages = [ ../xml/repository2-3.xml ];
20 images = [
21 ../xml/android-sys-img2-3.xml
22 ../xml/android-tv-sys-img2-3.xml
23 ../xml/google_apis-sys-img2-3.xml
24 ../xml/google_apis_playstore-sys-img2-3.xml
25 ../xml/android-wear-sys-img2-3.xml
26 ../xml/android-wear-cn-sys-img2-3.xml
27 ../xml/android-automotive-sys-img2-3.xml
28 ];
29 addons = [ ../xml/addon2-3.xml ];
30 };
31 };
32
33 androidComposition = androidEnv.composeAndroidPackages sdkArgs;
34 androidSdk = androidComposition.androidsdk;
35 platformTools = androidComposition.platform-tools;
36 jdk = pkgs.jdk;
37in
38pkgs.mkShell {
39 name = "androidenv-example-ifd-demo";
40 packages = [
41 androidSdk
42 platformTools
43 jdk
44 ];
45
46 LANG = "C.UTF-8";
47 LC_ALL = "C.UTF-8";
48 JAVA_HOME = jdk.home;
49
50 # Note: ANDROID_HOME is deprecated. Use ANDROID_SDK_ROOT.
51 ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
52
53 shellHook = ''
54 # Write out local.properties for Android Studio.
55 cat <<EOF > local.properties
56 # This file was automatically generated by nix-shell.
57 sdk.dir=$ANDROID_SDK_ROOT
58 EOF
59 '';
60}