-
Notifications
You must be signed in to change notification settings - Fork 12
/
flake.nix
82 lines (80 loc) · 2.79 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
{
description = "Hydra app for Android";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, devshell, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlays.default ];
config.allowUnfree = true;
config.android_sdk.accept_license = true;
};
androidVersions = builtins.fromTOML (builtins.readFile ./android-versions.toml);
androidComposition = pkgs.androidenv.composeAndroidPackages {
cmdLineToolsVersion = androidVersions.cmdLineToolsVersion;
toolsVersion = null;
platformToolsVersion = androidVersions.platformToolsVersion;
buildToolsVersions = [ androidVersions.buildToolsVersions ];
includeEmulator = true;
emulatorVersion = "34.1.9";
includeSystemImages = true;
systemImageTypes = [ "google_apis_playstore" ];
abiVersions = [ "x86_64" ];
platformVersions = [ androidVersions.platformVersions ];
includeSources = true;
includeNDK = false;
useGoogleAPIs = true;
includeExtras = [
"extras;google;gcm"
];
extraLicenses = [
"android-sdk-license"
];
};
aapt2Override = "${androidComposition.androidsdk}/libexec/android-sdk/build-tools/${androidVersions.buildToolsVersions}/aapt2";
in
{
devShells = rec {
default = hydra-android;
hydra-android = pkgs.devshell.mkShell {
name = "hydra-android";
packages = [
androidComposition.androidsdk pkgs.jdk11 pkgs.git pkgs.androidStudioPackages.beta
];
env = [
{
name = "JAVA_HOME";
eval = pkgs.jdk17.home;
}
{
name = "ANDROID_SDK_ROOT";
eval = "${androidComposition.androidsdk}/libexec/android-sdk";
}
{
name = "GRADLE_OPTS";
eval = "-Pandroid.aapt2FromMavenOverride=${aapt2Override}";
}
{
name = "GRADLE_HOME";
eval = "$PRJ_DATA_DIR/.gradle";
}
];
devshell.startup.link.text = ''
mkdir -p "$PRJ_DATA_DIR/.gradle"
cat <<EOF > "$PRJ_DATA_DIR/.gradle/gradle.properties"
android.aapt2FromMavenOverride=${aapt2Override}
EOF
'';
};
};
}
);
}