From dbcb178ef2619661d6f99cc6532cb353d6ec99c0 Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Tue, 6 Aug 2013 11:16:51 +0200 Subject: [PATCH] Added extraAVDFiles parameter to support custom system images --- pkgs/development/mobile/androidenv/emulate-app.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/development/mobile/androidenv/emulate-app.nix b/pkgs/development/mobile/androidenv/emulate-app.nix index ae8b7f8d1ef..0ae934b572a 100644 --- a/pkgs/development/mobile/androidenv/emulate-app.nix +++ b/pkgs/development/mobile/androidenv/emulate-app.nix @@ -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 &