summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/misc/android-tools/default.nix
blob: a3048bb55a1c129b916a5a3c81a9a6ad5ad9028f (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
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
{
  lib,
  stdenv,
  fetchurl,
  cmake,
  ninja,
  pkg-config,
  perl,
  python3,
  # fails to build with protobuf_36
  # FIXME: unpin when upstream is fixed
  protobuf_35,
  zlib,
  gtest,
  brotli,
  lz4,
  zstd,
  libusb1,
  pcre2,
  fmt,
}:

let
  pythonEnv = python3.withPackages (ps: [ ps.protobuf ]);
in

stdenv.mkDerivation rec {
  pname = "android-tools";
  version = "37.0.0";

  src = fetchurl {
    url = "https://github.com/nmeum/android-tools/releases/download/${version}/android-tools-${version}.tar.xz";
    hash = "sha256-JyXQn4kqOjjlNEKfR6Mh9Y7PajFpyqQskV+yy31Gvg4=";
  };

  nativeBuildInputs = [
    cmake
    ninja
    pkg-config
    perl
  ];
  buildInputs = [
    protobuf_35
    zlib
    gtest
    brotli
    lz4
    zstd
    libusb1
    pcre2
    fmt
  ];
  propagatedBuildInputs = [ pythonEnv ];

  meta = {
    description = "Android SDK platform tools";
    longDescription = ''
      Android SDK Platform-Tools is a component for the Android SDK. It
      includes tools that interface with the Android platform, such as adb and
      fastboot. These tools are required for Android app development. They're
      also needed if you want to unlock your device bootloader and flash it
      with a new system image.
      Currently the following tools are supported:
      - adb
      - fastboot
      - mke2fs.android (required by fastboot)
      - simg2img, img2simg, append2simg
      - lpdump, lpmake, lpadd, lpflash, lpunpack
      - mkbootimg, unpack_bootimg, repack_bootimg, avbtool
      - mkdtboimg
    '';
    # https://developer.android.com/studio/command-line#tools-platform
    # https://developer.android.com/studio/releases/platform-tools
    homepage = "https://github.com/nmeum/android-tools";
    license = with lib.licenses; [
      asl20
      unicode-dfs-2015
      mit
    ];
    platforms = lib.platforms.unix;
    teams = [ lib.teams.android ];
  };
}