From b2b3b4b7681d7d8736c11fa031cb707c8af61720 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 19 Jul 2025 10:41:28 +0200 Subject: [PATCH] androidsdk: move throw behind meta.license check This allows evaluating the package's meta attribute without triggering the throw, thus making it possible to list the package in the search results. It also avoids CI falling over with this attribute. --- .../androidenv/compose-android-packages.nix | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/pkgs/development/mobile/androidenv/compose-android-packages.nix b/pkgs/development/mobile/androidenv/compose-android-packages.nix index 1803a04a6638..44259a2f2e48 100644 --- a/pkgs/development/mobile/androidenv/compose-android-packages.nix +++ b/pkgs/development/mobile/androidenv/compose-android-packages.nix @@ -631,32 +631,32 @@ lib.recurseIntoAttrs rec { # 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. - androidsdk = - if !licenseAccepted then - throw '' - ${builtins.concatStringsSep "\n\n" (mkLicenseTexts licenseNames)} + androidsdk = callPackage ./cmdline-tools.nix { + inherit + deployAndroidPackage + os + arch + meta + ; - You must accept the following licenses: - ${lib.concatMapStringsSep "\n" (str: " - ${str}") licenseNames} + package = cmdline-tools-package; - a) - by setting nixpkgs config option 'android_sdk.accept_license = true;'. - b) - 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 - arch - meta - ; + postInstall = + if !licenseAccepted then + throw '' + ${builtins.concatStringsSep "\n\n" (mkLicenseTexts licenseNames)} - package = cmdline-tools-package; + You must accept the following licenses: + ${lib.concatMapStringsSep "\n" (str: " - ${str}") licenseNames} - postInstall = '' + a) + by setting nixpkgs config option 'android_sdk.accept_license = true;'. + b) + by an environment variable for a single invocation of the nix tools. + $ export NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE=1 + '' + else + '' # Symlink all requested plugins ${linkPlugin { name = "platform-tools"; @@ -769,5 +769,5 @@ lib.recurseIntoAttrs rec { '' ) licenseNames} ''; - }; + }; }