diff --git a/pkgs/development/mobile/androidenv/cmdline-tools.nix b/pkgs/development/mobile/androidenv/cmdline-tools.nix index b3ca1c171b65..11ad37453f2a 100644 --- a/pkgs/development/mobile/androidenv/cmdline-tools.nix +++ b/pkgs/development/mobile/androidenv/cmdline-tools.nix @@ -1,4 +1,4 @@ -{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgsi686Linux, stdenv, cmdLineToolsVersion, postInstall}: +{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgsi686Linux, stdenv, postInstall}: deployAndroidPackage { name = "androidsdk"; @@ -16,7 +16,7 @@ deployAndroidPackage { export ANDROID_SDK_ROOT="$out/libexec/android-sdk" # Wrap all scripts that require JAVA_HOME - find $ANDROID_SDK_ROOT/cmdline-tools/${cmdLineToolsVersion}/bin -maxdepth 1 -type f -executable | while read program; do + 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.jdk11}/bin \ --prefix ANDROID_SDK_ROOT : $ANDROID_SDK_ROOT @@ -24,12 +24,12 @@ deployAndroidPackage { done # Wrap sdkmanager script - wrapProgram $ANDROID_SDK_ROOT/cmdline-tools/${cmdLineToolsVersion}/bin/sdkmanager \ + wrapProgram $ANDROID_SDK_ROOT/${package.path}/bin/sdkmanager \ --prefix PATH : ${lib.makeBinPath [ pkgs.jdk11 ]} \ --add-flags "--sdk_root=$ANDROID_SDK_ROOT" # Patch all script shebangs - patchShebangs $ANDROID_SDK_ROOT/cmdline-tools/${cmdLineToolsVersion}/bin + patchShebangs $ANDROID_SDK_ROOT/${package.path}/bin cd $ANDROID_SDK_ROOT ${postInstall} diff --git a/pkgs/development/mobile/androidenv/compose-android-packages.nix b/pkgs/development/mobile/androidenv/compose-android-packages.nix index 4ae136d52c55..8414217002d9 100644 --- a/pkgs/development/mobile/androidenv/compose-android-packages.nix +++ b/pkgs/development/mobile/androidenv/compose-android-packages.nix @@ -314,6 +314,8 @@ rec { '') plugins} ''; # */ + cmdline-tools-package = check-version packages "cmdline-tools" cmdLineToolsVersion; + # This derivation deploys the tools package and symlinks all the desired # plugins that we want to use. If the license isn't accepted, prints all the licenses # requested and throws. @@ -329,9 +331,9 @@ rec { by an environment variable for a single invocation of the nix tools. $ export NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE=1 '' else callPackage ./cmdline-tools.nix { - inherit deployAndroidPackage os cmdLineToolsVersion; + inherit deployAndroidPackage os; - package = check-version packages "cmdline-tools" cmdLineToolsVersion; + package = cmdline-tools-package; postInstall = '' # Symlink all requested plugins @@ -375,7 +377,7 @@ rec { ln -s $i $out/bin done - find $ANDROID_SDK_ROOT/cmdline-tools/${cmdLineToolsVersion}/bin -type f -executable | while read i; do + find $ANDROID_SDK_ROOT/${cmdline-tools-package.path}/bin -type f -executable | while read i; do ln -s $i $out/bin done