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:
Hy4ri
2026-07-02 23:14:34 +03:00
parent b709e6d8da
commit fba06cea95
+17 -14
View File
@@ -6,9 +6,13 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config = { config = {
@@ -18,20 +22,22 @@
}; };
buildToolsVersion = "35.0.0"; buildToolsVersion = "35.0.0";
androidComposition = pkgs.androidenv.composeAndroidPackages { androidSdk = (pkgs.androidenv.composeAndroidPackages {
# Command-line & platform tools # Command-line & platform tools
cmdLineToolsVersion = "11.0"; cmdLineToolsVersion = "11.0";
platformToolsVersion = "35.0.2"; platformToolsVersion = "35.0.2";
# Build tools # Build tools
buildToolsVersions = [ buildToolsVersion "34.0.0" ]; buildToolsVersions = [buildToolsVersion "34.0.0"];
# Target platforms (36 required by AGP 9.0.1 / compileSdk 36) # Target platforms (36 required by AGP 9.0.1 / compileSdk 36)
platformVersions = [ "36" "35" "34" ]; platformVersions = ["36" "35" "34"];
# For the emulator # Emulator + system images for local AVD testing
includeEmulator = false; includeEmulator = true;
includeSystemImages = false; includeSystemImages = true;
systemImageTypes = ["google_apis"];
abiVersions = ["x86_64"];
# NDK (not needed for this project, but handy) # NDK (not needed for this project, but handy)
includeNDK = false; includeNDK = false;
@@ -47,17 +53,14 @@
"intel-android-sysimage-license" "intel-android-sysimage-license"
"mips-android-sysimage-license" "mips-android-sysimage-license"
]; ];
}; }).androidsdk;
androidSdk = androidComposition.androidsdk;
in { in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
# Java 21 (required for AGP 9.x / Gradle 9.x) # Java 21 (required for AGP 9.x / Gradle 9.x)
jdk21 jdk21
# Android SDK (platforms, build-tools, platform-tools) # Android SDK (platforms, build-tools, platform-tools, emulator, system-images)
androidSdk androidSdk
# Kotlin compiler # Kotlin compiler