forked from extern/Unexpected-Keyboard
3373c59b90
The build takes place on the remote, which takes advantage of Nix's caching. The previous workflow used a remote cache but in order to build locally, all the dependencies needed to be downloaded from the cache everytime. The dependencies are 462M, downloading took most of the time.
36 lines
872 B
Nix
36 lines
872 B
Nix
{ pkgs ? import <nixpkgs> {
|
|
config.android_sdk.accept_license = true;
|
|
config.allowUnfree = true;
|
|
} }:
|
|
|
|
let
|
|
android = pkgs.androidenv.composeAndroidPackages {
|
|
buildToolsVersions = [ "30.0.3" ];
|
|
platformVersions = [ "30" ];
|
|
abiVersions = [ "armeabi-v7a" ];
|
|
};
|
|
|
|
buildInputs =
|
|
[ pkgs.findutils pkgs.openjdk8 android.androidsdk pkgs.fontforge ];
|
|
|
|
# Env variable required by the Makefile
|
|
ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
|
|
|
|
# Build the debug APK. Exposed as an attribute, used in CI
|
|
debug-apk = pkgs.stdenv.mkDerivation {
|
|
name = "unexpected-keyboard-debug";
|
|
src = ./.;
|
|
inherit buildInputs ANDROID_HOME;
|
|
buildPhase = ''
|
|
make
|
|
'';
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
mv _build/*.apk $out
|
|
'';
|
|
};
|
|
|
|
in pkgs.mkShell { inherit buildInputs ANDROID_HOME; } // {
|
|
inherit debug-apk;
|
|
}
|