Added extraAVDFiles parameter to support custom system images

This commit is contained in:
Sander van der Burg 2013-08-06 11:16:51 +02:00
parent ed70cc9830
commit dbcb178ef2

View file

@ -1,5 +1,8 @@
{stdenv, androidsdk}:
{name, app ? null, platformVersion ? "8", abiVersion ? "armeabi-v7a", useGoogleAPIs ? false, enableGPU ? false, package ? null, activity ? null}:
{ name, app ? null
, platformVersion ? "8", abiVersion ? "armeabi-v7a", useGoogleAPIs ? false
, enableGPU ? false, extraAVDFiles ? []
, package ? null, activity ? null}:
assert app != null -> package != null && activity != null;
@ -54,11 +57,15 @@ stdenv.mkDerivation {
# Create a virtual android device
yes "" | ${androidsdkComposition}/libexec/android-sdk-*/tools/android create avd -n device -t ${if useGoogleAPIs then "'Google Inc.:Google APIs:"+platformVersion+"'" else "android-"+platformVersion}
# Enable GPU acceleration
${stdenv.lib.optionalString enableGPU ''
# Enable GPU acceleration
echo "hw.gpu.enabled=yes" >> $ANDROID_SDK_HOME/.android/avd/device.avd/config.ini
''}
${stdenv.lib.concatMapStrings (extraAVDFile: ''
ln -sf ${extraAVDFile} $ANDROID_SDK_HOME/.android/avd/device.avd
'') extraAVDFiles}
# Launch the emulator
${androidsdkComposition}/libexec/android-sdk-*/tools/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &