abouttreesummaryrefslogcommitdiff
path: root/shell.nix
blob: 1ee5012255c1d44c223f18caf8dfabcd48bc2a08 (plain)
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
{ 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;
}