system/hosts/home/configs/android.nix

52 lines
1.5 KiB
Nix
Raw Normal View History

2024-04-16 02:51:46 +03:00
{ pkgs, ... }:
let
buildToolsVersion = "33.0.2";
androidComposition = pkgs.unstable.androidenv.composeAndroidPackages {
platformToolsVersion = "34.0.5";
buildToolsVersions = [ buildToolsVersion ];
includeEmulator = false;
emulatorVersion = "34.1.9";
platformVersions = [ "29" "30" "33" ];
includeSources = false;
includeSystemImages = false;
systemImageTypes = [ "google_apis_playstore" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
cmakeVersions = [ "3.10.2" ];
includeNDK = true;
ndkVersions = [ "23.2.8568313" ];
useGoogleAPIs = false;
useGoogleTVAddOns = false;
includeExtras = [
"extras;google;gcm"
];
};
in
{
# TODO: try to remove this.
nixpkgs.config.allowUnfree = true;
local.nix.allowUnfreePackages = [ "android-sdk-cmdline-tools" ];
programs.adb.enable = true;
programs.java = {
enable = true;
package = pkgs.jdk17;
};
nixpkgs.config.android_sdk.accept_license = true;
environment.variables = rec {
ANDROID_SDK_ROOT = "${androidComposition.androidsdk}/libexec/android-sdk";
ANDROID_NDK_ROOT = "${ANDROID_SDK_ROOT}/ndk-bundle";
# Use the same buildToolsVersion here
# GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${buildToolsVersion}/aapt2";
# JAVA_HOME = pkgs.jdk17.home;
};
services.udev.extraRules = ''
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev"
'';
}