{
"nodes": {
+ "android-nixpkgs": {
+ "inputs": {
+ "devshell": "devshell",
+ "flake-utils": "flake-utils",
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1744057253,
+ "narHash": "sha256-cXV1MuZiFpee239JVYfzhxa8FYv6Qm3upmWdo4N2ms8=",
+ "owner": "tadfisher",
+ "repo": "android-nixpkgs",
+ "rev": "b6b6602b927e15f4851b119b2c726768f02e2527",
+ "type": "github"
+ },
+ "original": {
+ "owner": "tadfisher",
+ "repo": "android-nixpkgs",
+ "type": "github"
+ }
+ },
+ "devshell": {
+ "inputs": {
+ "nixpkgs": [
+ "android-nixpkgs",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1741473158,
+ "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
+ "owner": "numtide",
+ "repo": "devshell",
+ "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "devshell",
+ "type": "github"
+ }
+ },
"flake-utils": {
"inputs": {
"systems": "systems"
"type": "github"
}
},
+ "flake-utils_2": {
+ "inputs": {
+ "systems": "systems_2"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
"nixpkgs": {
"locked": {
"lastModified": 1743938762,
},
"root": {
"inputs": {
- "flake-utils": "flake-utils",
+ "android-nixpkgs": "android-nixpkgs",
+ "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
}
},
"repo": "default",
"type": "github"
}
+ },
+ "systems_2": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
}
},
"root": "root",
{
+ # UsageNote: to run the emulator
+ # nix -L run .#emulate-android-x86_64
+ #
+ # UsageNote: to run load gradle into $PATH
+ # nix -L develop
description = "Nix flake to develop for Android";
+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
+
+ # ExplanationNote: an alternative way to install Android tools,
+ # not sure if it's better than nixpkgs' machinery at anything.
+ # Just here for reference.
+ inputs.android-nixpkgs = {
+ url = "github:tadfisher/android-nixpkgs";
+
+ # ExplanationNote:
+ # The main branch follows the "canary" channel of the Android SDK
+ # repository. Use another android-nixpkgs branch to explicitly
+ # track an SDK release channel.
+ #
+ # url = "github:tadfisher/android-nixpkgs/stable";
+ # url = "github:tadfisher/android-nixpkgs/beta";
+ # url = "github:tadfisher/android-nixpkgs/preview";
+ # url = "github:tadfisher/android-nixpkgs/canary";
+
+ # ExplanationNote: replace the "nixpkgs" input for the "android-nixpkgs" flake.
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
outputs =
inputs:
let
app = null;
deviceName = "device";
package = "";
+
# ToDo: set this when the emulator will be working
# for emulate-android-armeabi-v7a
# or emulate-android-arm64-v8a
{
packages = rec {
default = emulate-android-x86_64;
+
emulate-android-x86_64 = androidEmulateApp { abiVersion = "x86_64"; };
- # FixMe: PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.
+
+ # FailureNote: PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.
+ # ExplanationNote: https://developer.android.com/studio/releases/emulator#support_for_arm_binaries_on_android_9_and_11_system_images
+ # If you were previously unable to use the Android Emulator because
+ # your app depended on ARM binaries, you can now use the Android 9
+ # x86 system image or any Android 11 system image to run your app –
+ # it is no longer necessary to download a specific system image to
+ # run ARM binaries. These Android 9 and Android 11 system images
+ # support ARM by default and provide dramatically improved
+ # performance when compared to those with full ARM emulation.
emulate-android-arm64-v8a = androidEmulateApp { abiVersion = "arm64-v8a"; };
- # FixMe: PANIC: CPU Architecture 'arm' is not supported by the QEMU2 emulator, (the classic engine is deprecated!)
+
+ # FailureNote: PANIC: CPU Architecture 'arm' is not supported by the QEMU2 emulator, (the classic engine is deprecated!)
# Note: only androidPlatformVersion <= 25 still provide images for this ABI
# See nixpkgs/pkgs/development/mobile/androidenv/repo.json
emulate-android-armeabi-v7a = androidEmulateApp { abiVersion = "armeabi-v7a"; };
+
+ android-sdk = inputs.android-nixpkgs.sdk (
+ sdkPkgs: with sdkPkgs; [
+ cmdline-tools-latest
+ build-tools-34-0-0
+ platform-tools
+ platforms-android-34
+ emulator
+ ]
+ );
};
devShell =
export ANDROID_NDK_ROOT="${androidComposition.androidsdk}/libexec/android-sdk/ndk-bundle"
export PATH="$(echo "$ANDROID_SDK_ROOT/cmake/${androidCmakeVersion}".*/bin):$PATH"
- # Use the same androidBuildToolsVersion and a statically linked aapt2
+ # Use the same androidBuildToolsVersion
+ # and a statically linked aapt2 to workaround a dynamic linking failure.
export GRADLE_OPTS="-Dorg.gradle.project.android.aapt2FromMavenOverride=$ANDROID_SDK_ROOT/build-tools/${androidBuildToolsVersion}/aapt2";
'';
};