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.
This commit is contained in:
Wolfgang Walther
2025-07-19 13:09:48 +02:00
parent ccd127bc7c
commit b2b3b4b768
@@ -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}
'';
};
};
}