From 7c005a7b69437f2068d9b4ded03dc79ff8afb0de Mon Sep 17 00:00:00 2001 From: Hadi Date: Thu, 10 Aug 2023 20:09:15 -0400 Subject: [PATCH] androidenv fix cmdline beta versions' problem --- pkgs/development/mobile/androidenv/cmdline-tools.nix | 8 ++++---- .../mobile/androidenv/compose-android-packages.nix | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) 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 4777e7f95a79..ccd0907c9e95 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