about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/mobile
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
commitf34a1b70eb86e4a63cfb88ea460345bb1aed88e3 (patch)
tree32834d23912250e0c4b86aa4420baacf8091c0fe /nixpkgs/pkgs/development/mobile
parent003ab91dd67b093890db1dd0bab564345db6e496 (diff)
parent7a7cfff8915e06365bc2365ff33d4d413184fa9f (diff)
downloadnixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.gz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.bz2
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.lz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.xz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.zst
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/development/mobile')
-rw-r--r--nixpkgs/pkgs/development/mobile/androidenv/emulate-app.nix37
-rw-r--r--nixpkgs/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix1
-rw-r--r--nixpkgs/pkgs/development/mobile/genymotion/default.nix4
3 files changed, 27 insertions, 15 deletions
diff --git a/nixpkgs/pkgs/development/mobile/androidenv/emulate-app.nix b/nixpkgs/pkgs/development/mobile/androidenv/emulate-app.nix
index 74e002bdd16f..e4b3af304fa9 100644
--- a/nixpkgs/pkgs/development/mobile/androidenv/emulate-app.nix
+++ b/nixpkgs/pkgs/development/mobile/androidenv/emulate-app.nix
@@ -1,16 +1,26 @@
 { composeAndroidPackages, stdenv, lib, runtimeShell }:
-{ name, app ? null
+{ name
+, app ? null
 , platformVersion ? "33"
 , abiVersion ? "armeabi-v7a"
 , systemImageType ? "default"
-, enableGPU ? false
-, extraAVDFiles ? []
+, enableGPU ? false # Enable GPU acceleration. It's deprecated, instead use `configOptions` below.
+, configOptions ? (
+    # List of options to add in config.ini
+    lib.optionalAttrs enableGPU
+      (lib.warn
+        "enableGPU argument is deprecated and will be removed; use configOptions instead"
+        { "hw.gpu.enabled" = "yes"; }
+      )
+  )
+, extraAVDFiles ? [ ]
 , package ? null
 , activity ? null
 , androidUserHome ? null
 , avdHomeDir ? null # Support old variable with non-standard naming!
 , androidAvdHome ? avdHomeDir
-, sdkExtraArgs ? {}
+, deviceName ? "device"
+, sdkExtraArgs ? { }
 , androidAvdFlags ? null
 , androidEmulatorFlags ? null
 }:
@@ -99,27 +109,28 @@ stdenv.mkDerivation {
     export ANDROID_SERIAL="emulator-$port"
 
     # Create a virtual android device for testing if it does not exist
-    if [ "$(${sdk}/bin/avdmanager list avd | grep 'Name: device')" = "" ]
+    if [ "$(${sdk}/bin/avdmanager list avd | grep 'Name: ${deviceName}')" = "" ]
     then
         # Create a virtual android device
-        yes "" | ${sdk}/bin/avdmanager create avd --force -n device -k "system-images;android-${platformVersion};${systemImageType};${abiVersion}" -p $ANDROID_AVD_HOME $NIX_ANDROID_AVD_FLAGS
+        yes "" | ${sdk}/bin/avdmanager create avd --force -n ${deviceName} -k "system-images;android-${platformVersion};${systemImageType};${abiVersion}" -p $ANDROID_AVD_HOME/${deviceName}.avd $NIX_ANDROID_AVD_FLAGS
 
-        ${lib.optionalString enableGPU ''
-          # Enable GPU acceleration
-          echo "hw.gpu.enabled=yes" >> $ANDROID_AVD_HOME/device.avd/config.ini
-        ''}
+        ${builtins.concatStringsSep "\n" (
+          lib.mapAttrsToList (configKey: configValue: ''
+            echo "${configKey} = ${configValue}" >> $ANDROID_AVD_HOME/${deviceName}.avd/config.ini
+          '') configOptions
+        )}
 
         ${lib.concatMapStrings (extraAVDFile: ''
-          ln -sf ${extraAVDFile} $ANDROID_AVD_HOME/device.avd
+          ln -sf ${extraAVDFile} $ANDROID_AVD_HOME/${deviceName}.avd
         '') extraAVDFiles}
     fi
 
     # Launch the emulator
     echo "\nLaunch the emulator"
-    $ANDROID_SDK_ROOT/emulator/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
+    $ANDROID_SDK_ROOT/emulator/emulator -avd ${deviceName} -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
 
     # Wait until the device has completely booted
-    echo "Waiting until the emulator has booted the device and the package manager is ready..." >&2
+    echo "Waiting until the emulator has booted the ${deviceName} and the package manager is ready..." >&2
 
     ${sdk}/libexec/android-sdk/platform-tools/adb -s emulator-$port wait-for-device
 
diff --git a/nixpkgs/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix b/nixpkgs/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix
index 4cee79824a6b..3c08887eb5be 100644
--- a/nixpkgs/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix
+++ b/nixpkgs/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix
@@ -78,6 +78,7 @@ let
   androidComposition = androidEnv.composeAndroidPackages sdkArgs;
   androidEmulator = androidEnv.emulateApp {
     name = "android-sdk-emulator-demo";
+    configOptions = { "hw.keyboard" = "yes"; };
     sdkExtraArgs = sdkArgs;
   };
   androidSdk = androidComposition.androidsdk;
diff --git a/nixpkgs/pkgs/development/mobile/genymotion/default.nix b/nixpkgs/pkgs/development/mobile/genymotion/default.nix
index f8b5c9f5610c..b3ebaf713058 100644
--- a/nixpkgs/pkgs/development/mobile/genymotion/default.nix
+++ b/nixpkgs/pkgs/development/mobile/genymotion/default.nix
@@ -24,11 +24,11 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "genymotion";
-  version = "3.5.1";
+  version = "3.6.0";
   src = fetchurl {
     url = "https://dl.genymotion.com/releases/genymotion-${version}/genymotion-${version}-linux_x64.bin";
     name = "genymotion-${version}-linux_x64.bin";
-    sha256 = "sha256-Bgp2IB8af5FV2W22GlAkzybLB/5UYnJSC607OZHejjo=";
+    sha256 = "sha256-CS1A9udt47bhgnYJqqkCG3z4XaPVHmz417VTsY2ccOA=";
   };
 
   nativeBuildInputs = [ makeWrapper ];