summaryrefslogtreecommitdiff
path: root/pkgs/development/mobile/androidenv/examples/shell-ifd.nix
blob: 3024fa43f7ad9a2dfaab2c08ded9877bd88a3b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  # If you want to use the in-tree version of nixpkgs:
  pkgs ? import ../../../../.. {
    config.allowUnfree = true;
  },

  licenseAccepted ? pkgs.callPackage ../license.nix { },
}:

# Tests IFD with androidenv. Needs a folder of `../xml` in your local tree;
# use ../fetchrepo.sh to produce it.
let
  androidEnv = pkgs.callPackage ./.. {
    inherit pkgs licenseAccepted;
  };

  sdkArgs = {
    repoXmls = {
      packages = [ ../xml/repository2-3.xml ];
      images = [
        ../xml/android-sys-img2-3.xml
        ../xml/android-tv-sys-img2-3.xml
        ../xml/google_apis-sys-img2-3.xml
        ../xml/google_apis_playstore-sys-img2-3.xml
        ../xml/android-wear-sys-img2-3.xml
        ../xml/android-wear-cn-sys-img2-3.xml
        ../xml/android-automotive-sys-img2-3.xml
      ];
      addons = [ ../xml/addon2-3.xml ];
    };
  };

  androidComposition = androidEnv.composeAndroidPackages sdkArgs;
  androidSdk = androidComposition.androidsdk;
  platformTools = androidComposition.platform-tools;
  jdk = pkgs.jdk;
in
pkgs.mkShell {
  name = "androidenv-example-ifd-demo";
  packages = [
    androidSdk
    platformTools
    jdk
  ];

  LANG = "C.UTF-8";
  LC_ALL = "C.UTF-8";
  JAVA_HOME = jdk.home;

  ANDROID_HOME = "${androidSdk}/libexec/android-sdk";

  shellHook = ''
    # Write out local.properties for Android Studio.
    cat <<EOF > local.properties
    # This file was automatically generated by nix-shell.
    sdk.dir=$ANDROID_HOME
    EOF
  '';
}