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.
This commit is contained in:
Morgan Jones 2025-04-07 00:57:25 -07:00 committed by Masum Reza
parent eb786288e1
commit a59e06abc4

View File

@ -175,7 +175,13 @@ 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: