From a59e06abc4b9a6ab348fb2293592f1b8bc15d077 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Mon, 7 Apr 2025 00:57:25 -0700 Subject: [PATCH] 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. --- .../androidenv/compose-android-packages.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/development/mobile/androidenv/compose-android-packages.nix b/pkgs/development/mobile/androidenv/compose-android-packages.nix index e7552862c2b7..c63e20d43733 100644 --- a/pkgs/development/mobile/androidenv/compose-android-packages.nix +++ b/pkgs/development/mobile/androidenv/compose-android-packages.nix @@ -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: