system/hosts/home/configs/android.nix

60 lines
1.6 KiB
Nix

{ pkgs, ... }:
let
androidComposition = pkgs.unstable.androidenv.composeAndroidPackages {
platformToolsVersion = "35.0.2";
buildToolsVersions = [
"33.0.2"
"34.0.0"
"35.0.1"
];
includeEmulator = true;
emulatorVersion = "35.3.10";
platformVersions = [ "29" "33" "34" ];
includeSources = false;
includeSystemImages = true;
systemImageTypes = [ "google_apis_playstore" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
cmakeVersions = [ "3.10.2" ];
includeNDK = true;
ndkVersions = [ "27.0.12077973" ];
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.systemPackages = [
pkgs.unstable.androidenv.androidPkgs.platform-tools
(pkgs.unstable.android-studio.withSdk androidComposition.androidsdk)
];
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"
'';
}