cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.5k stars 339 forks source link

android ndk 27.x not selectable #1453

Open cguentherTUChemnitz opened 2 months ago

cguentherTUChemnitz commented 2 months ago

Describe the bug When i select in devenv.nix android.ndk.version = [] any of the 27.x releases as shown here: https://github.com/android/ndk/releases, devenv is telling that the version does not exist, even without telling which version it is seeing. I updated also to cmdLineTools.version = "12.0" but it did not help.

To reproduce

  android = {
    enable = true;
    platforms.version = [ "32" "34" ];
    systemImageTypes = [ "google_apis_playstore" ];
    abis = [ "arm64-v8a" "x86_64" ];
    # cmakeVersions = [ "3.22.1" ];
    cmdLineTools.version = "12.0";
    tools.version = "26.1.1";
    platformTools.version = "35.0.1";
    buildTools.version = [ "35.0.0-rc2" ];
    emulator = {
      enable = true;
      version = "35.1.4";
    };
    sources.enable = false;
    systemImages.enable = true;
    ndk = {
      enable = true;
      version = [ "27.1.12297006" ];
    };
    googleAPIs.enable = true;
    googleTVAddOns.enable = true;
    extras = [ "extras;google;gcm" ];
    extraLicenses = [
      "android-sdk-preview-license"
      "android-googletv-license"
      "android-sdk-arm-dbt-license"
      "google-gdk-license"
      "intel-android-extra-license"
      "intel-android-sysimage-license"
      "mips-android-sysimage-license"
    ];
    android-studio = {
      enable = true;
      package = pkgs.android-studio;
    };
  };

direnv allow

       … while calling the 'sort' builtin
         at /nix/store/39rsyaxxn4sqvjb721n4sj5dj0fzpi1m-cjz8w4dgc3rd2n3dqv5c208vygndjyba-source/pkgs/development/mobile/androidenv/deploy-androidpackages.nix:6:20:
            5|   extraParams = removeAttrs args [ "packages" "os" "buildInputs" "nativeBuildInputs" "patchesInstructions" ];
            6|   sortedPackages = builtins.sort (x: y: builtins.lessThan x.name y.name) packages;
             |                    ^
            7|

       error: at /nix/store/39rsyaxxn4sqvjb721n4sj5dj0fzpi1m-cjz8w4dgc3rd2n3dqv5c208vygndjyba-source/pkgs/development/mobile/androidenv/compose-android-packages.nix:245:54:
          244|       inherit deployAndroidPackage os platform-tools;
          245|       package = packages.ndk-bundle.${ndkVersion} or packages.ndk.${ndkVersion};
             |                                                      ^
          246|     };

       error: attribute '"27.1.12297006"' missing

Make sure to include full logs and what you expected to happen.

Version https://devenv.sh 1.1.0

cguentherTUChemnitz commented 4 weeks ago

As far as i understand is this the point, where the selectable ndks are defined: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/androidndk-pkgs/default.nix

I am trying to write some overlays to provide the ndk 27.2 but i am failing to do so. Can anyone provide a meaningful override to provide current ndk in devenv.nix?

My current attempt is something like this:

{
  pkgs,
  lib,
  config,
  inputs,
  ...
}:
let
  system = pkgs.stdenv.system;
  nixpkgs = import inputs.nixpkgs {
    inherit system;
    overlays = [
      (final: prev: {
        androidndkPkgs = prev.androidndkPkgs // {
          "27" = prev.androidenv.composeAndroidPackages {
            includeNDK = true;
            ndkVersion = "27.2.12479018";
          };
        };
      })
    ];
  };
in
{
  android = {
    enable = true;
    platforms.version = [ "35" ];
    systemImageTypes = [ "google_apis_playstore" ];
    abis = [ "arm64-v8a" "x86_64" ];
    cmdLineTools.version = "12.0";
    emulator = {
      enable = true;
      version = "35.2.5";
    };
    sources.enable = false;
    systemImages.enable = true;
    ndk = {
      enable = true;
      version = [ "27" ];
    };
    extraLicenses = [
      "android-sdk-preview-license"
      "android-googletv-license"
      "android-sdk-arm-dbt-license"
      "google-gdk-license"
      "intel-android-extra-license"
      "intel-android-sysimage-license"
      "mips-android-sysimage-license"
    ];
  };
}

But it does not pick up the populated version 27, even running with github:NixOS/nixpkgs/nixpkgs-unstable channel