Commit a59e06ab authored by Morgan Jones's avatar Morgan Jones Committed by Masum Reza
Browse files

androidenv: fix weird package naming and add versions

Some of the system images and NDK packages looked like:
`androidenv.androidPkgs.all.system_images.v35.google_apis_playstore.x_86___64`.
`androidenv.androidPkgs.all.packages.ndk.v21_0_6011959_rc_2`

Now they look like:
`androidenv.androidPkgs.all.system-images.v35.google_apis_playstore.x86_64`.
`androidenv.androidPkgs.all.packages.ndk.v21_0_6011959-rc2`

They should also have the versions correctly attached now for s.n.o.
parent eb786288
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -175,6 +175,12 @@ let
                passthru = {
                  info = packageInfo;
                };
              }).overrideAttrs
                (prev: {
                  # fetchurl won't generate the correct filename if we specify pname and version,
                  # and we still want the version attribute to show up in search, so specify these in an override
                  pname = packageInfo.name;
                  version = packageInfo.revision;
                })
            ) validArchives
          )
@@ -207,8 +213,11 @@ let
      # Converts things like 'extras;google;auto' to 'extras-google-auto'
      toVersionKey =
        name:
        lib.optionalString (lib.match "^[0-9].*" name != null) "v"
        + lib.concatStringsSep "_" (lib.splitVersion (lib.replaceStrings [ ";" ] [ "-" ] name));
        let
          normalizedName = lib.replaceStrings [ ";" "." ] [ "-" "_" ] name;
          versionParts = lib.match "^([0-9][0-9\\.]*)(.*)$" normalizedName;
        in
        if versionParts == null then normalizedName else "v" + lib.concatStrings versionParts;

      recurse = lib.mapAttrs' (
        name: value: