-
Notifications
You must be signed in to change notification settings - Fork 42
/
flake.nix
84 lines (84 loc) · 2.77 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
description = "Orgly Android nix build";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixgl.url = "github:nix-community/nixGL";
};
outputs = {
nixpkgs,
flake-utils,
nixgl,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config = {
android_sdk.accept_license = true;
};
overlays = [nixgl.overlay];
};
cmakeVersion = "3.22.1";
buildToolsVersion = "34.0.0";
cmdLineToolsVersion = "8.0";
androidComposition = pkgs.androidenv.composeAndroidPackages {
cmdLineToolsVersion = cmdLineToolsVersion;
toolsVersion = "26.1.1";
platformToolsVersion = "34.0.5";
buildToolsVersions = ["30.0.3" "33.0.1" buildToolsVersion];
includeEmulator = true;
platformVersions = ["30" "33" "34"];
includeSources = false;
includeSystemImages = true;
systemImageTypes = ["google_apis_playstore"];
abiVersions = ["x86-64" "x86_64"];
cmakeVersions = [cmakeVersion];
includeNDK = true;
ndkVersions = ["23.1.7779620" "25.1.8937393" "26.1.10909125"];
useGoogleAPIs = true;
useGoogleTVAddOns = false;
includeExtras = [
"extras;google;gcm"
];
};
sharedDeps = with pkgs; [
alejandra
just
];
android-sdk = androidComposition.androidsdk;
android-home = "${androidComposition.androidsdk}/libexec/android-sdk";
cmakeDir = "${android-home}/cmake/${cmakeVersion}/bin";
emulator = "${android-home}/emulator";
cmdLineTools = "${android-home}/cmdline-tools/${cmdLineToolsVersion}/bin";
aapt2Binary = "${android-home}/build-tools/${buildToolsVersion}/aapt2";
additionalPath = builtins.concatStringsSep ":" [cmakeDir emulator cmdLineTools];
in {
devShells = with pkgs; {
default = mkShell {
buildInputs =
sharedDeps
++ [gradle_8 watchman]
++ (
if system == "x86_64-linux"
then [pkgs.nixgl.auto.nixGLDefault pkgs.nixgl.nixGLIntel]
else []
);
LC_ALL = "en_US.UTF-8";
LANG = "en_US.UTF-8";
CMAKE_DIR = cmakeDir;
ANDROID_HOME = android-home;
ANDROID_NDK_ROOT = "${android-home}/ndk-bundle";
ANDROID_SDK_BIN = android-home;
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${aapt2Binary}";
shellHook =
''
export JAVA_HOME=${pkgs.jdk17.home};
source ${android-sdk.out}/nix-support/setup-hook
export ORG_GRADLE_PROJECT_ANDROID_HOME="$ANDROID_HOME"
export PATH=${additionalPath}:$PATH
'';
};
};
});
}