NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.05k stars 14.04k forks source link

`composeAndroidPackages` always includes emulator #281261

Open berberman opened 9 months ago

berberman commented 9 months ago

Describe the bug

A clear and concise description of what the bug is.

androidenv.composeAndroidPackages builds emulator while includeEmulator is set to false.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create the following test.nix:

    with import <nixpkgs> {
    config = {
    android_sdk.accept_license = true;
    allowUnfree = true;
    };
    };
    androidenv.composeAndroidPackages {
    platformVersions = [ "34" ];
    buildToolsVersions = [ "34.0.0" ];
    platformToolsVersion = "34.0.4";
    includeNDK = false;
    includeEmulator = false;
    includeSources = false;
    }
  2. Run nix-build test.nix

  3. The following outputs are built:

/nix/store/mxzagz0vhg0jz1ivwlg95wn7bp1kvbfc-androidsdk
/nix/store/zdg047rkg1iy3663g8w7kgxwm4h2z30b-android-sdk-emulator-34.1.9
/nix/store/rm3ilh7b98xj8y93n8s9vjdvn1sqvblb-android-sdk-patcher-1
/nix/store/32zh6si2yfqyz4rbx1nh5b1s96j63s7z-android-sdk-platform-tools-34.0.4
/nix/store/x26mb430ym19j9zah7m0aydfjpgvavai-androidsdk

This brings a lot unnecessary dependencies into the closure:

$ nix-store --query --references /nix/store/zdg047rkg1iy3663g8w7kgxwm4h2z30b-android-sdk-emulator-34.1.9
/nix/store/p3jshbwxiwifm1py0yq544fmdyy98j8a-glibc-2.38-27
/nix/store/hbksywp6j5zabm9j5yp8in1l7h524w7b-libxcb-1.16
/nix/store/i0jkvikpn3rp3n80hw06fsw06n1v8w81-libX11-1.8.7
/nix/store/7hij9gahccyi1793dgi80qqqnbj4f4bv-libXfixes-6.0.1
/nix/store/11ir2yz6xhgs6gk79g6mhdh2c1ihp9vs-libXdamage-1.1.6
/nix/store/15c38h5lyfqdawxyagv98f9whr0ckc29-expat-2.5.0
/nix/store/1n4yiax2bfz17j0gcm3c0xfxigd4rb2s-dbus-1.14.10-lib
/nix/store/2xaviyb2mqfv3hcrxpf5919sa41xjsm0-libXext-1.3.5
/nix/store/qs1llsl5x27d9fhgzrhdfypn146z52xd-libXi-1.8.1
/nix/store/382ghq192b7y2gb7yx2mx3a6j5qpbkm2-libXtst-1.2.4
/nix/store/3dimjffv8pn3sk48ngd4adz17agpfb4y-gcc-13.2.0-libgcc
/nix/store/5iq3f1g321si8d68fr5vncavkv07jr80-util-linux-minimal-2.39.3-lib
/nix/store/9vafkkic27k7m4934fpawl6yip3a6k4h-bash-5.2-p21
/nix/store/a35370ccdvy7rlcg2q6v6sjzqf1fpy3j-xkeyboard-config-2.40
/nix/store/adcl5lwf0pm9lsirfn5sjzy6vhv2mwsm-libXrender-0.9.11
/nix/store/aj31kl54q3v1d0am5np0snbw9libv4ww-libpulseaudio-16.1
/nix/store/bzjr9mcffxbvhi4h2r43canrr83mi876-alsa-lib-1.2.9
/nix/store/gd6qfmxa2cms0nqymzjc62k70pmzvm27-nspr-4.35
/nix/store/i43ix7srp9r2c92s79qj4vkx0av3m1b9-libXcursor-1.2.1
/nix/store/ikdynl302bag4xswkvb6vc6pi3bnnw62-ncurses-abi5-compat-6.4
/nix/store/kc5vgp55kvlmwfc9qkipk8jrq10k3rsv-libXcomposite-0.4.6
/nix/store/kgw3386qxmwj1hw1j1wckh92wbnzm21k-nss-3.90.1
/nix/store/mrzfvc2gjy2mia0k4vrb95f2iff6xcxm-zlib-1.3
/nix/store/vfmf8qh892jfl107hih0yfnic00byjgj-systemd-254.6
/nix/store/zdg047rkg1iy3663g8w7kgxwm4h2z30b-android-sdk-emulator-34.1.9

Expected behavior

The emulator shouldn't be included.

Notify maintainers

@hadilq

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.72, NixOS, 24.05 (Uakari), 24.05.20240113.9b19f5e`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/ydrvksq2wh34qqkklq145bq8jxfk2s3g-b0l3v8509hrl3qbv6fj2zl0mjb2rwhdy-source`

Add a :+1: reaction to issues you find important.

hadilq commented 9 months ago

Thank you for your contribution. I'll check it out this weekend.

hadilq commented 9 months ago

It's ready to review.