summary refs log tree commit diff
path: root/pkgs/development/mobile
diff options
context:
space:
mode:
authorSander van der Burg <svanderburg@gmail.com>2014-02-27 18:46:06 +0100
committerSander van der Burg <svanderburg@gmail.com>2014-02-27 18:46:06 +0100
commit416db1de92304cf683ef1492c409824f54aab1c1 (patch)
treeaf5922900f1247bd87b5356a1201e63b7eb4d4a7 /pkgs/development/mobile
parentfb448ba4a1f7ef02ab28090717cb47680ea76803 (diff)
downloadnixpkgs-416db1de92304cf683ef1492c409824f54aab1c1.tar
nixpkgs-416db1de92304cf683ef1492c409824f54aab1c1.tar.gz
nixpkgs-416db1de92304cf683ef1492c409824f54aab1c1.tar.bz2
nixpkgs-416db1de92304cf683ef1492c409824f54aab1c1.tar.lz
nixpkgs-416db1de92304cf683ef1492c409824f54aab1c1.tar.xz
nixpkgs-416db1de92304cf683ef1492c409824f54aab1c1.tar.zst
nixpkgs-416db1de92304cf683ef1492c409824f54aab1c1.zip
androidsdk: Make AVD storage dir configurable and make activation step optional
Diffstat (limited to 'pkgs/development/mobile')
-rw-r--r--pkgs/development/mobile/androidenv/emulate-app.nix18
1 files changed, 12 insertions, 6 deletions
diff --git a/pkgs/development/mobile/androidenv/emulate-app.nix b/pkgs/development/mobile/androidenv/emulate-app.nix
index 53687868102..5117c8aa247 100644
--- a/pkgs/development/mobile/androidenv/emulate-app.nix
+++ b/pkgs/development/mobile/androidenv/emulate-app.nix
@@ -2,9 +2,9 @@
 { name, app ? null
 , platformVersion ? "8", abiVersion ? "armeabi-v7a", useGoogleAPIs ? false
 , enableGPU ? false, extraAVDFiles ? []
-, package ? null, activity ? null}:
-
-assert app != null -> package != null && activity != null;
+, package ? null, activity ? null
+, avdHomeDir ? null
+}:
 
 let
   androidsdkComposition = androidsdk {
@@ -28,8 +28,12 @@ stdenv.mkDerivation {
         export TMPDIR=/tmp
     fi
     
-    # Store the virtual devices somewhere else, instead of polluting a user's HOME directory
-    export ANDROID_SDK_HOME=$(mktemp -d $TMPDIR/nix-android-vm-XXXX)
+    ${if avdHomeDir == null then ''
+      # Store the virtual devices somewhere else, instead of polluting a user's HOME directory
+      export ANDROID_SDK_HOME=$(mktemp -d $TMPDIR/nix-android-vm-XXXX)
+    '' else ''
+      export ANDROID_SDK_HOME=${avdHomeDir}
+    ''}
     
     # We have to look for a free TCP port
     
@@ -106,7 +110,9 @@ stdenv.mkDerivation {
       ${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port install "$appPath"
     
       # Start the application
-      ${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/.${activity}
+      ${stdenv.lib.optionalString (package != null && activity != null) ''
+          ${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/${activity}
+      ''}
     ''}
     EOF
     chmod +x $out/bin/run-test-emulator