summaryrefslogtreecommitdiffhomepage
path: root/nix/android-devshell.nix
blob: be769144ce4e9ab32886a35dacbe7c4cb86d1027 (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
36
37
38
39
40
41
{ pkgs, android-toolchain }:
pkgs.devshell.mkShell {
  name = "mullvad-android-devshell";
  inherit (android-toolchain) packages;

  env = import ./android-env.nix {
    inherit pkgs;
    inherit (android-toolchain)
      android-sdk
      jdk
      buildToolsVersion
      ndkVersion
      minSdkVersion
      ;
  };

  devshell.startup.prepare.text = ''
    export FLAKE_ROOT=$(git rev-parse --show-toplevel)
    export ANDROID_ROOT="$FLAKE_ROOT/android"
    cd "$ANDROID_ROOT"
  '';

  # Unfortunately rich menus with package, description and category
  # is only supported using the TOML format and not when using mkShell.
  # The two cannot be combined and TOML format by itself doesn't support
  # the way we dynamically configure the devshell.
  commands = [
    {
      name = "tasks";
      command = "$ANDROID_ROOT/gradlew -p $ANDROID_ROOT tasks";
    }
    {
      name = "build";
      command = "$ANDROID_ROOT/gradlew -p $ANDROID_ROOT assembleOssProdDebug";
    }
    {
      name = "buildRelease";
      command = "$ANDROID_ROOT/gradlew -p $ANDROID_ROOT assembleOssProdRelease";
    }
  ];
}