From ea4b2dbcbce077a47953522ad78d764b22a438a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20=C3=87al=C4=B1=C5=9Fkan?= Date: Mon, 30 Aug 2021 14:53:07 +0300 Subject: [PATCH] android-tools: install missing tools --- pkgs/tools/misc/android-tools/default.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/misc/android-tools/default.nix b/pkgs/tools/misc/android-tools/default.nix index b18366b057f9..8d74e74cb8ac 100644 --- a/pkgs/tools/misc/android-tools/default.nix +++ b/pkgs/tools/misc/android-tools/default.nix @@ -1,8 +1,12 @@ { lib, stdenv, fetchurl, fetchpatch -, cmake, perl, go +, cmake, perl, go, python3 , protobuf, zlib, gtest, brotli, lz4, zstd, libusb1, pcre2, fmt_7 }: +let + pythonEnv = python3.withPackages(ps: [ ps.protobuf ]); +in + stdenv.mkDerivation rec { pname = "android-tools"; version = "31.0.2"; @@ -23,8 +27,13 @@ stdenv.mkDerivation rec { }) ]; + postPatch = '' + sed -i -E "0,/import api_pb2/ s//from google.protobuf import api_pb2/" vendor/avb/aftltool.py + ''; + nativeBuildInputs = [ cmake perl go ]; buildInputs = [ protobuf zlib gtest brotli lz4 zstd libusb1 pcre2 fmt_7 ]; + propagatedBuildInputs = [ pythonEnv ]; # Don't try to fetch any Go modules via the network: GOFLAGS = [ "-mod=vendor" ]; @@ -33,6 +42,12 @@ stdenv.mkDerivation rec { export GOCACHE=$TMPDIR/go-cache ''; + postInstall = '' + install -Dm755 ../vendor/avb/aftltool.py -t $out/bin + install -Dm755 ../vendor/avb/avbtool.py -t $out/bin + install -Dm755 ../vendor/mkbootimg/mkbootimg.py $out/bin/mkbootimg + ''; + meta = with lib; { description = "Android SDK platform tools"; longDescription = ''