Because a single abi such as x86_64 can have multiple image variants which are not distinguished by checking only the
first tag. Android API 36x were particularly affected as they have both 4kb and 16kb memory page images.
Remove the inconsistent use of `tag` to determine the image path and ID. Instead the path is uniquely determined from
the source XML metadata's location while the `id` uses part of Google's `path` ID.
The `repo.json` is updated incrementally and the last version which was not affected by these issues was `a137f263af92`
so it has been regenerated based on that version.
Set a default value for VK_ADD_DRIVER_FILES so the SDK's vulkan-loader
can load NixOS vulkan drivers.
libGL needs to be in LD_LIBRARY_PATH to get loaded successfully.
Tested using:
```nix
androidenv.emulateApp {
name = "app";
platformVersion = "36";
abiVersion = "x86_64";
systemImageType = "google_apis_playstore";
configOptions = {
"hw.gpu.mode" = "host";
"hw.gpu.enabled" = "yes";
"hw.keyboard" = "yes";
};
}
```
ndk-build only needs java/javac, not GUI capabilities.
Switching to jdk_headless drops ~257 MB of unnecessary
desktop dependencies (GTK+3, icu4c, harfbuzz, cups, systemd)
from the closure.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
this creates some eval errors that will be fixed in the next commit
done with the following script:
```fish
\#!/usr/bin/env fish
set packagesjson (nix eval --impure --json --expr '
let
lib = import ./lib;
in
import pkgs/servers/x11/xorg/default.nix (lib.mapAttrs (
name: _:
if name == "lib" then
lib
else if name == "config" then
{ allowAliases = false; }
else
name
) (__functionArgs (import pkgs/servers/x11/xorg/default.nix))) { }
' | jq)
set one (grep '^ [A-Za-z0-9_-]*$' pkgs/servers/x11/xorg/default.nix | string trim | string replace -r '$' Z | sort | string sub -e -1)
set two (grep '^ [A-Za-z0-9_-]* = [A-Za-z0-9_-]*;$' pkgs/servers/x11/xorg/default.nix | cut -d= -f1 | string trim | string replace -r '$' Z | sort | string sub -e -1)
for arg in $one $two
set oname $arg
set nname (echo $packagesjson | jq -r .$oname)
if test $nname = null
echo (set_color red)warn:(set_color normal) unknown package xorg.$oname >&2
continue
end
echo $oname "->" $nname
# replace basic xorg.$name references
for file in (rg -F "xorg.$oname" --files-with-matches pkgs)
# special cases
sd -F "$oname = xorg.$oname;" "$nname = $nname;" $file
# replace
sd -F "xorg.$oname" "$nname" $file
# fixup function arguments
# prevent duplicate function args
if grep -E " ($oname|$nname),\$" $file >/dev/null
continue
end
if grep 'xorg\..' $file >/dev/null # case1: there is more so we can't just remove the function arg
if grep ' xorg,$' $file >/dev/null
sd ' xorg,$' " xorg,
$nname," $file
else if grep ' xorg ? .*,$' $file >/dev/null
sd 'xorg( ? .*),$' "xorg\$1,
$nname," $file
else
sd -F 'xorg,' "$nname,
xorg," $file
end
else # case there is no more xorg..* so we can just replace the function arg
sd 'xorg(| ? .*),.*$' "$nname," $file
end
end
end
nix fmt
```
Google have been releasing 'nonstandard' SDK versions for a while. Named
things like CANARY, UpsideDownCake, 36x, and so on, androidenv has been
generally unable to use them, instead preferring Google's officially
supported Android SDKs corresponding to the
[API levels](https://apilevels.com/) (e.g. "35" or "36").
Updates to those SDK versions have generally come in the form of
updates to Google's repositories that repo.json picks up.
These are mostly noneventful for end users, unless a user experienced a
bug in an API definition, then it tended to be picked up with an
androidenv repo update.
API 36.1 changes this. It's not just a number (so it doesn't correspond
to a unique API level). The previous attempt in #470569 simply preferred
the newer version to attempt to emulate the old behavior.
Unfortunately, this now requires a Gradle change (see #472561). So this
means we should just support all the strange SDK versions now and have a
test for it.
Note that only depending on "latest" (the default) will properly pick
these up as the latest, but using a min and max SDK version or
numLatestPlatformVersions > 1 will create a range of SDK versions as
before, which means you may miss (e.g.) 36.1 but will still have 36.
Considering that this requires `compileSdk "android-36.1"`
instead of a simple `compileSdk 36` in Gradle, it's recommended to
explicitly specify platformVersions if you depend on this change,
or use the defaults, where it will only install the latest.
Map 'latest' to the latest minor version of each SDK level, since Google
now has minor versions of SDK levels. The SDK levels are still integers,
so also map "36" to (e.g.) "36.1" by default, since the user likely
wants the latest revision of "36" we have.
Fix: #468525
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
Use `overrideAttrs` to specify the FOD name we want,
instead of specifying `pname` and `version`
and expect a broken overrideAttrs that won't update `name`.
Performed the following automatic androidenv updates:
- cmake: 4.1.1 -> 4.1.2
- emulator: 36.2.10 -> 36.2.12
Tests exited with status: 0
Last 100 lines of output:
```
/nix/store/0vb4227cmf3f6zq1skch0j9l221pzams-androidenv-test-suite
```