androidenv: move licenseAccepted condition to androidsdk

The NDK can be built without accepting the license.
This commit is contained in:
Matthew Bauer 2019-01-29 21:13:41 -05:00
parent 3115e3dbce
commit 9c770c4efa

View File

@ -20,20 +20,13 @@
, includeExtras ? [] , includeExtras ? []
}: }:
if !licenseAccepted then throw ''
You must accept the Android Software Development Kit License Agreement at
https://developer.android.com/studio/terms
by setting nixpkgs config option 'android_sdk.accept_license = true;'
''
else assert licenseAccepted;
let let
inherit (pkgs) stdenv fetchurl makeWrapper unzip; inherit (pkgs) stdenv fetchurl makeWrapper unzip;
# Determine the Android os identifier from Nix's system identifier # Determine the Android os identifier from Nix's system identifier
os = if stdenv.system == "x86_64-linux" then "linux" os = if stdenv.system == "x86_64-linux" then "linux"
else if stdenv.system == "x86_64-darwin" then "macosx" else if stdenv.system == "x86_64-darwin" then "macosx"
else "No tarballs found for system architecture: ${stdenv.system}"; else throw "No tarballs found for system architecture: ${stdenv.system}";
# Generated Nix packages # Generated Nix packages
packages = import ./generated/packages.nix { packages = import ./generated/packages.nix {
@ -196,7 +189,11 @@ rec {
# This derivation deploys the tools package and symlinks all the desired # This derivation deploys the tools package and symlinks all the desired
# plugins that we want to use. # plugins that we want to use.
androidsdk = import ./tools.nix { androidsdk = if !licenseAccepted then throw ''
You must accept the Android Software Development Kit License Agreement at
https://developer.android.com/studio/terms
by setting nixpkgs config option 'android_sdk.accept_license = true;'
'' else import ./tools.nix {
inherit deployAndroidPackage requireFile packages toolsVersion autoPatchelfHook makeWrapper os pkgs pkgs_i686; inherit deployAndroidPackage requireFile packages toolsVersion autoPatchelfHook makeWrapper os pkgs pkgs_i686;
inherit (stdenv) lib; inherit (stdenv) lib;