summary refs log tree commit diff
diff options
context:
space:
mode:
authorMustafa Çalışkan <musfay@protonmail.com>2021-08-30 14:53:07 +0300
committerMustafa Çalışkan <musfay@protonmail.com>2021-08-30 14:53:07 +0300
commitea4b2dbcbce077a47953522ad78d764b22a438a8 (patch)
treec52c7843f006bfa159d8235e92a0623ee02552fc
parent39067594f5d668caa701fc3e014a8b4bf73a9ac0 (diff)
downloadnixpkgs-ea4b2dbcbce077a47953522ad78d764b22a438a8.tar
nixpkgs-ea4b2dbcbce077a47953522ad78d764b22a438a8.tar.gz
nixpkgs-ea4b2dbcbce077a47953522ad78d764b22a438a8.tar.bz2
nixpkgs-ea4b2dbcbce077a47953522ad78d764b22a438a8.tar.lz
nixpkgs-ea4b2dbcbce077a47953522ad78d764b22a438a8.tar.xz
nixpkgs-ea4b2dbcbce077a47953522ad78d764b22a438a8.tar.zst
nixpkgs-ea4b2dbcbce077a47953522ad78d764b22a438a8.zip
android-tools: install missing tools
-rw-r--r--pkgs/tools/misc/android-tools/default.nix17
1 files changed, 16 insertions, 1 deletions
diff --git a/pkgs/tools/misc/android-tools/default.nix b/pkgs/tools/misc/android-tools/default.nix
index b18366b057f..8d74e74cb8a 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 = ''