feat(nix): enable Android emulator and system images in dev shell
Enable local AVD testing by including emulator and Google APIs system images (x86_64) in the Nix-managed Android SDK. Inline the intermediate androidComposition variable into androidSdk for clarity. Reformat input attributes and align shellHook output spacing.
This commit is contained in:
@@ -6,9 +6,13 @@
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
@@ -18,7 +22,7 @@
|
||||
};
|
||||
|
||||
buildToolsVersion = "35.0.0";
|
||||
androidComposition = pkgs.androidenv.composeAndroidPackages {
|
||||
androidSdk = (pkgs.androidenv.composeAndroidPackages {
|
||||
# Command-line & platform tools
|
||||
cmdLineToolsVersion = "11.0";
|
||||
platformToolsVersion = "35.0.2";
|
||||
@@ -29,9 +33,11 @@
|
||||
# Target platforms (36 required by AGP 9.0.1 / compileSdk 36)
|
||||
platformVersions = ["36" "35" "34"];
|
||||
|
||||
# For the emulator
|
||||
includeEmulator = false;
|
||||
includeSystemImages = false;
|
||||
# Emulator + system images for local AVD testing
|
||||
includeEmulator = true;
|
||||
includeSystemImages = true;
|
||||
systemImageTypes = ["google_apis"];
|
||||
abiVersions = ["x86_64"];
|
||||
|
||||
# NDK (not needed for this project, but handy)
|
||||
includeNDK = false;
|
||||
@@ -47,17 +53,14 @@
|
||||
"intel-android-sysimage-license"
|
||||
"mips-android-sysimage-license"
|
||||
];
|
||||
};
|
||||
|
||||
androidSdk = androidComposition.androidsdk;
|
||||
|
||||
}).androidsdk;
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
# Java 21 (required for AGP 9.x / Gradle 9.x)
|
||||
jdk21
|
||||
|
||||
# Android SDK (platforms, build-tools, platform-tools)
|
||||
# Android SDK (platforms, build-tools, platform-tools, emulator, system-images)
|
||||
androidSdk
|
||||
|
||||
# Kotlin compiler
|
||||
|
||||
Reference in New Issue
Block a user