nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 deployAndroidPackage,
3 lib,
4 stdenv,
5 package,
6 os,
7 arch,
8 autoPatchelfHook,
9 makeWrapper,
10 pkgs,
11 pkgsi686Linux,
12 postInstall,
13 meta,
14}:
15
16deployAndroidPackage {
17 name = "androidsdk-tools";
18 inherit package os arch;
19 nativeBuildInputs = [ makeWrapper ] ++ lib.optionals (os == "linux") [ autoPatchelfHook ];
20 buildInputs = lib.optional (os == "linux") (
21 (with pkgs; [
22 glibc
23 freetype
24 fontconfig
25 fontconfig.lib
26 stdenv.cc.cc.libgcc or null # fix for https://github.com/NixOS/nixpkgs/issues/226357
27 libx11
28 libxrender
29 libxext
30 ])
31 ++ lib.optionals (os == "linux" && stdenv.isx86_64) (
32 with pkgsi686Linux;
33 [
34 glibc
35 libx11
36 libxrender
37 libxext
38 fontconfig.lib
39 freetype
40 zlib
41 ]
42 )
43 );
44
45 patchInstructions = ''
46 ${lib.optionalString (os == "linux") ''
47 # Auto patch all binaries
48 autoPatchelf .
49 ''}
50
51 # Wrap all scripts that require JAVA_HOME
52 for i in bin; do
53 find $i -maxdepth 1 -type f -executable | while read program; do
54 if grep -q "JAVA_HOME" $program; then
55 wrapProgram $PWD/$program --prefix PATH : ${pkgs.jdk8}/bin
56 fi
57 done
58 done
59
60 # Wrap monitor script
61 wrapProgram $PWD/monitor \
62 --prefix PATH : ${pkgs.jdk8}/bin \
63 --prefix LD_LIBRARY_PATH : ${
64 lib.makeLibraryPath (
65 with pkgs;
66 [
67 libx11
68 libxtst
69 ]
70 )
71 }
72
73 # Patch all script shebangs
74 patchShebangs .
75
76 cd $out/libexec/android-sdk
77 ${postInstall}
78 '';
79
80 inherit meta;
81}