forked from fcitx5-android/fcitx5-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
85 lines (80 loc) · 3.3 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
85
{
description = "Dev shell flake for fcitx5-android";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.android_sdk.accept_license = true;
config.allowUnfree = true;
overlays = [ self.overlays.default ];
};
in {
devShells = {
default = pkgs.fcitx5-android.sdk.shell;
noAS =
pkgs.fcitx5-android.sdk.shell.override { androidStudio = null; };
};
}) // {
overlays.default = final: prev: {
fcitx5-android = {
sdk = final.lib.makeExtensible (self: {
# Update versions here
# This should match to build-logic/convention/src/main/kotlin/Versions.kt
cmakeVersion = "3.22.1";
buildToolsVersion = "35.0.0";
platformToolsVersion = "35.0.2";
platformVersion = "35";
ndkVersion = "25.2.9519653";
includeNDK = true;
androidComposition = final.androidenv.composeAndroidPackages {
inherit (self) platformToolsVersion ndkVersion includeNDK;
buildToolsVersions = [ self.buildToolsVersion ];
platformVersions = [ self.platformVersion ];
cmakeVersions = [ self.cmakeVersion ];
includeEmulator = false;
includeSources = true;
};
shell = final.lib.makeOverridable
({ androidStudio, generateLocalProperties, exportCMakeBin }:
with final;
with self;
mkShell rec {
buildInputs = [
androidComposition.androidsdk
extra-cmake-modules
gettext
python39
icu
androidStudio
];
ANDROID_SDK_ROOT =
"${androidComposition.androidsdk}/libexec/android-sdk";
ANDROID_HOME = ANDROID_SDK_ROOT;
NDK_VERSION = ndkVersion;
BUILD_TOOLS_VERSION = buildToolsVersion;
GRADLE_OPTS =
"-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidComposition.androidsdk}/libexec/android-sdk/build-tools/${buildToolsVersion}/aapt2";
ECM_DIR = "${extra-cmake-modules}/share/ECM/cmake/";
JAVA_HOME = "${jdk17}";
shellHook = lib.optionalString exportCMakeBin ''
export PATH="$ANDROID_SDK_ROOT/cmake/${cmakeVersion}/bin:$PATH"
'' + lib.optionalString generateLocalProperties ''
echo sdk.dir=$ANDROID_SDK_ROOT > local.properties
'';
}) {
androidStudio = final.androidStudioPackages.beta;
generateLocalProperties = true;
exportCMakeBin = true;
};
});
};
};
};
}