Loading doc/languages-frameworks/android.section.md +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ Alternatively, you can pass composeAndroidPackages to the `withSdk` passthrough: } ``` These will export `ANDROID_SDK_ROOT` and `ANDROID_NDK_ROOT` to the SDK and NDK directories These will export `ANDROID_HOME` and `ANDROID_NDK_ROOT` to the SDK and NDK directories in the specified Android build environment. ## Deploying an Android SDK installation with plugins {#deploying-an-android-sdk-installation-with-plugins} Loading pkgs/applications/editors/android-studio/common.nix +9 −8 Original line number Diff line number Diff line Loading @@ -253,21 +253,22 @@ let startScript = let hasAndroidSdk = androidSdk != null; androidSdkRoot = lib.optionalString hasAndroidSdk "${androidSdk}/libexec/android-sdk"; androidHome = lib.optionalString hasAndroidSdk "${androidSdk}/libexec/android-sdk"; in '' #!${runtimeShell} ${lib.optionalString hasAndroidSdk '' echo "=== nixpkgs Android Studio wrapper" >&2 # Default ANDROID_SDK_ROOT to the packaged one, if not provided. ANDROID_SDK_ROOT="''${ANDROID_SDK_ROOT-${androidSdkRoot}}" # Default ANDROID_HOME to the packaged one, if not provided. ANDROID_HOME="''${ANDROID_HOME-${androidHome}}" if [ -d "$ANDROID_HOME" ]; then export ANDROID_HOME echo " - ANDROID_HOME=$ANDROID_HOME" >&2 if [ -d "$ANDROID_SDK_ROOT" ]; then export ANDROID_SDK_ROOT # Legacy compatibility. export ANDROID_HOME="$ANDROID_SDK_ROOT" echo " - ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >&2 export ANDROID_SDK_ROOT="$ANDROID_HOME" # See if we can export ANDROID_NDK_ROOT too. ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk-bundle" Loading @@ -282,8 +283,8 @@ let unset ANDROID_NDK_ROOT fi else unset ANDROID_SDK_ROOT unset ANDROID_HOME unset ANDROID_SDK_ROOT fi ''} exec ${lib.getExe fhsEnv} ${lib.getExe androidStudio} "$@" Loading pkgs/development/mobile/androidenv/cmdline-tools.nix +13 −11 Original line number Diff line number Diff line Loading @@ -27,25 +27,27 @@ deployAndroidPackage { ''} # Strip double dots from the root path export ANDROID_SDK_ROOT="$out/libexec/android-sdk" # Wrap all scripts that require JAVA_HOME find $ANDROID_SDK_ROOT/${package.path}/bin -maxdepth 1 -type f -executable | while read program; do if grep -q "JAVA_HOME" $program; then wrapProgram $program --prefix PATH : ${pkgs.jdk17}/bin \ --prefix ANDROID_SDK_ROOT : $ANDROID_SDK_ROOT export ANDROID_HOME="$out/libexec/android-sdk" # Wrap all scripts that require JAVA_HOME. # Use ANDROID_SDK_ROOT as legacy compatibility but the "correct" way is ANDROID_HOME nowadays (2026+). find "$ANDROID_HOME/${package.path}/bin" -maxdepth 1 -type f -executable | while read program; do if grep -q "JAVA_HOME" "$program"; then wrapProgram "$program" --prefix PATH : ${pkgs.jdk17}/bin \ --prefix ANDROID_HOME : "$ANDROID_HOME" \ --prefix ANDROID_SDK_ROOT : "$ANDROID_HOME" fi done # Wrap sdkmanager script wrapProgram $ANDROID_SDK_ROOT/${package.path}/bin/sdkmanager \ wrapProgram "$ANDROID_HOME/${package.path}/bin/sdkmanager" \ --prefix PATH : ${lib.makeBinPath [ pkgs.jdk17 ]} \ --add-flags "--sdk_root=$ANDROID_SDK_ROOT" --add-flags "--sdk_root=$ANDROID_HOME" # Patch all script shebangs patchShebangs $ANDROID_SDK_ROOT/${package.path}/bin patchShebangs "$ANDROID_HOME/${package.path}/bin" cd $ANDROID_SDK_ROOT cd "$ANDROID_HOME" ${postInstall} ''; Loading pkgs/development/mobile/androidenv/compose-android-packages.nix +1 −1 Original line number Diff line number Diff line Loading @@ -798,7 +798,7 @@ lib.recurseIntoAttrs rec { done ''} find $ANDROID_SDK_ROOT/${cmdline-tools-package.path}/bin -type f -executable | while read i; do find "$ANDROID_HOME/${cmdline-tools-package.path}/bin" -type f -executable | while read i; do ln -s $i $out/bin done Loading pkgs/development/mobile/androidenv/emulate-app.nix +5 −3 Original line number Diff line number Diff line Loading @@ -87,8 +87,10 @@ stdenv.mkDerivation { '' } # We need to specify the location of the Android SDK root folder export ANDROID_SDK_ROOT=${sdk}/libexec/android-sdk # We need to specify the location of the Android SDK root folder. # Still export ANDROID_SDK_ROOT for legacy compatibility. export ANDROID_HOME=${sdk}/libexec/android-sdk export ANDROID_SDK_ROOT="$ANDROID_HOME" ${lib.optionalString (androidAvdFlags != null) '' # If NIX_ANDROID_AVD_FLAGS is empty Loading Loading @@ -146,7 +148,7 @@ stdenv.mkDerivation { # Launch the emulator echo "\nLaunch the emulator" $ANDROID_SDK_ROOT/emulator/emulator -avd ${deviceName} -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS & "$ANDROID_HOME/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 ${deviceName} and the package manager is ready..." >&2 Loading Loading
doc/languages-frameworks/android.section.md +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ Alternatively, you can pass composeAndroidPackages to the `withSdk` passthrough: } ``` These will export `ANDROID_SDK_ROOT` and `ANDROID_NDK_ROOT` to the SDK and NDK directories These will export `ANDROID_HOME` and `ANDROID_NDK_ROOT` to the SDK and NDK directories in the specified Android build environment. ## Deploying an Android SDK installation with plugins {#deploying-an-android-sdk-installation-with-plugins} Loading
pkgs/applications/editors/android-studio/common.nix +9 −8 Original line number Diff line number Diff line Loading @@ -253,21 +253,22 @@ let startScript = let hasAndroidSdk = androidSdk != null; androidSdkRoot = lib.optionalString hasAndroidSdk "${androidSdk}/libexec/android-sdk"; androidHome = lib.optionalString hasAndroidSdk "${androidSdk}/libexec/android-sdk"; in '' #!${runtimeShell} ${lib.optionalString hasAndroidSdk '' echo "=== nixpkgs Android Studio wrapper" >&2 # Default ANDROID_SDK_ROOT to the packaged one, if not provided. ANDROID_SDK_ROOT="''${ANDROID_SDK_ROOT-${androidSdkRoot}}" # Default ANDROID_HOME to the packaged one, if not provided. ANDROID_HOME="''${ANDROID_HOME-${androidHome}}" if [ -d "$ANDROID_HOME" ]; then export ANDROID_HOME echo " - ANDROID_HOME=$ANDROID_HOME" >&2 if [ -d "$ANDROID_SDK_ROOT" ]; then export ANDROID_SDK_ROOT # Legacy compatibility. export ANDROID_HOME="$ANDROID_SDK_ROOT" echo " - ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >&2 export ANDROID_SDK_ROOT="$ANDROID_HOME" # See if we can export ANDROID_NDK_ROOT too. ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk-bundle" Loading @@ -282,8 +283,8 @@ let unset ANDROID_NDK_ROOT fi else unset ANDROID_SDK_ROOT unset ANDROID_HOME unset ANDROID_SDK_ROOT fi ''} exec ${lib.getExe fhsEnv} ${lib.getExe androidStudio} "$@" Loading
pkgs/development/mobile/androidenv/cmdline-tools.nix +13 −11 Original line number Diff line number Diff line Loading @@ -27,25 +27,27 @@ deployAndroidPackage { ''} # Strip double dots from the root path export ANDROID_SDK_ROOT="$out/libexec/android-sdk" # Wrap all scripts that require JAVA_HOME find $ANDROID_SDK_ROOT/${package.path}/bin -maxdepth 1 -type f -executable | while read program; do if grep -q "JAVA_HOME" $program; then wrapProgram $program --prefix PATH : ${pkgs.jdk17}/bin \ --prefix ANDROID_SDK_ROOT : $ANDROID_SDK_ROOT export ANDROID_HOME="$out/libexec/android-sdk" # Wrap all scripts that require JAVA_HOME. # Use ANDROID_SDK_ROOT as legacy compatibility but the "correct" way is ANDROID_HOME nowadays (2026+). find "$ANDROID_HOME/${package.path}/bin" -maxdepth 1 -type f -executable | while read program; do if grep -q "JAVA_HOME" "$program"; then wrapProgram "$program" --prefix PATH : ${pkgs.jdk17}/bin \ --prefix ANDROID_HOME : "$ANDROID_HOME" \ --prefix ANDROID_SDK_ROOT : "$ANDROID_HOME" fi done # Wrap sdkmanager script wrapProgram $ANDROID_SDK_ROOT/${package.path}/bin/sdkmanager \ wrapProgram "$ANDROID_HOME/${package.path}/bin/sdkmanager" \ --prefix PATH : ${lib.makeBinPath [ pkgs.jdk17 ]} \ --add-flags "--sdk_root=$ANDROID_SDK_ROOT" --add-flags "--sdk_root=$ANDROID_HOME" # Patch all script shebangs patchShebangs $ANDROID_SDK_ROOT/${package.path}/bin patchShebangs "$ANDROID_HOME/${package.path}/bin" cd $ANDROID_SDK_ROOT cd "$ANDROID_HOME" ${postInstall} ''; Loading
pkgs/development/mobile/androidenv/compose-android-packages.nix +1 −1 Original line number Diff line number Diff line Loading @@ -798,7 +798,7 @@ lib.recurseIntoAttrs rec { done ''} find $ANDROID_SDK_ROOT/${cmdline-tools-package.path}/bin -type f -executable | while read i; do find "$ANDROID_HOME/${cmdline-tools-package.path}/bin" -type f -executable | while read i; do ln -s $i $out/bin done Loading
pkgs/development/mobile/androidenv/emulate-app.nix +5 −3 Original line number Diff line number Diff line Loading @@ -87,8 +87,10 @@ stdenv.mkDerivation { '' } # We need to specify the location of the Android SDK root folder export ANDROID_SDK_ROOT=${sdk}/libexec/android-sdk # We need to specify the location of the Android SDK root folder. # Still export ANDROID_SDK_ROOT for legacy compatibility. export ANDROID_HOME=${sdk}/libexec/android-sdk export ANDROID_SDK_ROOT="$ANDROID_HOME" ${lib.optionalString (androidAvdFlags != null) '' # If NIX_ANDROID_AVD_FLAGS is empty Loading Loading @@ -146,7 +148,7 @@ stdenv.mkDerivation { # Launch the emulator echo "\nLaunch the emulator" $ANDROID_SDK_ROOT/emulator/emulator -avd ${deviceName} -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS & "$ANDROID_HOME/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 ${deviceName} and the package manager is ready..." >&2 Loading