summary refs log tree commit diff
path: root/pkgs/development/mobile/androidenv
diff options
context:
space:
mode:
authorHadi <hadilashkari@gmail.com>2023-02-01 17:52:02 -0500
committerHadi <hadilashkari@gmail.com>2023-02-28 08:53:43 -0500
commita05928d7fed88bea451eb865a122197a4aed4e3a (patch)
tree4bad2830675ef0f8509c407e3873f2718817bc62 /pkgs/development/mobile/androidenv
parentd511bfd0e28b8190f6f29ef46daded4c0dc20c94 (diff)
downloadnixpkgs-a05928d7fed88bea451eb865a122197a4aed4e3a.tar
nixpkgs-a05928d7fed88bea451eb865a122197a4aed4e3a.tar.gz
nixpkgs-a05928d7fed88bea451eb865a122197a4aed4e3a.tar.bz2
nixpkgs-a05928d7fed88bea451eb865a122197a4aed4e3a.tar.lz
nixpkgs-a05928d7fed88bea451eb865a122197a4aed4e3a.tar.xz
nixpkgs-a05928d7fed88bea451eb865a122197a4aed4e3a.tar.zst
nixpkgs-a05928d7fed88bea451eb865a122197a4aed4e3a.zip
androidenv: make `nix-build -A androidenv.test-suite` work
androidenv: set config.allowUnfree = true for integration tests

androidenv: fix concerns in the PR
Diffstat (limited to 'pkgs/development/mobile/androidenv')
-rw-r--r--pkgs/development/mobile/androidenv/compose-android-packages.nix6
-rw-r--r--pkgs/development/mobile/androidenv/default.nix2
-rw-r--r--pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix3
-rw-r--r--pkgs/development/mobile/androidenv/examples/shell.nix3
-rw-r--r--pkgs/development/mobile/androidenv/test-suite.nix15
5 files changed, 18 insertions, 11 deletions
diff --git a/pkgs/development/mobile/androidenv/compose-android-packages.nix b/pkgs/development/mobile/androidenv/compose-android-packages.nix
index ce08de7db6d..8c24b10093b 100644
--- a/pkgs/development/mobile/androidenv/compose-android-packages.nix
+++ b/pkgs/development/mobile/androidenv/compose-android-packages.nix
@@ -312,7 +312,11 @@ rec {
     You must accept the following licenses:
     ${lib.concatMapStringsSep "\n" (str: "  - ${str}") licenseNames}
 
-    by setting nixpkgs config option 'android_sdk.accept_license = true;'.
+    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 cmdLineToolsVersion;
 
diff --git a/pkgs/development/mobile/androidenv/default.nix b/pkgs/development/mobile/androidenv/default.nix
index 9bd9fb9a543..3de6bf6e478 100644
--- a/pkgs/development/mobile/androidenv/default.nix
+++ b/pkgs/development/mobile/androidenv/default.nix
@@ -1,5 +1,5 @@
 { config, pkgs ? import <nixpkgs> {}
-, licenseAccepted ? config.android_sdk.accept_license or false
+, licenseAccepted ? config.android_sdk.accept_license or (builtins.getEnv "NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE" == "1")
 }:
 
 rec {
diff --git a/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix b/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix
index b9ebe844a01..ebfe97b856a 100644
--- a/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix
+++ b/pkgs/development/mobile/androidenv/examples/shell-with-emulator.nix
@@ -46,7 +46,8 @@ let
   # Otherwise, just use the in-tree androidenv:
   androidEnv = pkgs.callPackage ./.. {
     inherit config pkgs;
-    licenseAccepted = true;
+    # You probably need to uncomment below line to express consent.
+    # licenseAccepted = true;
   };
 
   sdkArgs = {
diff --git a/pkgs/development/mobile/androidenv/examples/shell.nix b/pkgs/development/mobile/androidenv/examples/shell.nix
index 5f821af1437..775f69bce4c 100644
--- a/pkgs/development/mobile/androidenv/examples/shell.nix
+++ b/pkgs/development/mobile/androidenv/examples/shell.nix
@@ -56,7 +56,8 @@ let
   # Otherwise, just use the in-tree androidenv:
   androidEnv = pkgs.callPackage ./.. {
     inherit config pkgs;
-    licenseAccepted = true;
+    # You probably need to uncomment below line to express consent.
+    # licenseAccepted = true;
   };
 
   androidComposition = androidEnv.composeAndroidPackages {
diff --git a/pkgs/development/mobile/androidenv/test-suite.nix b/pkgs/development/mobile/androidenv/test-suite.nix
index 725858e57f2..b5aeca43246 100644
--- a/pkgs/development/mobile/androidenv/test-suite.nix
+++ b/pkgs/development/mobile/androidenv/test-suite.nix
@@ -1,18 +1,19 @@
-{ stdenv, callPackage }:
+{callPackage, lib, stdenv}:
 let
   examples-shell = callPackage ./examples/shell.nix {};
   examples-shell-with-emulator = callPackage ./examples/shell-with-emulator.nix {};
+  all-tests = examples-shell.passthru.tests //
+    examples-shell-with-emulator.passthru.tests;
 in
 stdenv.mkDerivation {
   name = "androidenv-test-suite";
+  buidInputs = lib.mapAttrsToList (name: value: value) all-tests;
 
-  src = ./.;
-
-  dontConfigure = true;
-  dontBuild = true;
+  buildCommand = ''
+    touch $out
+  '';
 
-  passthru.tests = examples-shell.passthru.tests //
-    examples-shell-with-emulator.passthru.tests;
+  passthru.tests = all-tests;
 
   meta.timeout = 60;
 }