Added extraAVDFiles parameter to support custom system images
This commit is contained in:
parent
ed70cc9830
commit
dbcb178ef2
|
@ -1,5 +1,8 @@
|
||||||
{stdenv, androidsdk}:
|
{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;
|
assert app != null -> package != null && activity != null;
|
||||||
|
|
||||||
|
@ -54,11 +57,15 @@ stdenv.mkDerivation {
|
||||||
# Create a virtual android device
|
# 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}
|
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 ''
|
${stdenv.lib.optionalString enableGPU ''
|
||||||
|
# Enable GPU acceleration
|
||||||
echo "hw.gpu.enabled=yes" >> $ANDROID_SDK_HOME/.android/avd/device.avd/config.ini
|
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
|
# Launch the emulator
|
||||||
${androidsdkComposition}/libexec/android-sdk-*/tools/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
|
${androidsdkComposition}/libexec/android-sdk-*/tools/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue