nixpkgs-suyu/pkgs/development/mobile/androidenv/emulator.nix
Freeman Latif 954b406ac2 androidenv: add missing linux dependencies
This is extracted from https://github.com/NixOS/nixpkgs PR 78623.

The symptom I observed was:
```
builder for '/nix/store/7zz585ch9jqjvz8k88rf7fs046inxszq-emulator-30.0.3.drv' failed with exit code 1; last 10 log lines:
    libXext.so.6 -> found: /nix/store/qkmj8pa3ka9v335bbgx74ah4080fwdbf-libXext-1.3.4/lib/libXext.so.6
    libXfixes.so.3 -> found: /nix/store/nhp59xxq4g51mgpwgjsp8pvkn7531b86-libXfixes-5.0.3/lib/libXfixes.so.3
    libXi.so.6 -> not found!
    libXrender.so.1 -> not found!
    libXtst.so.6 -> not found!
    libasound.so.2 -> not found!
    libz.so.1 -> found: /nix/store/pb2am7dfsv524pb2z7m8mp8nkcmgd3cl-zlib-1.2.11/lib/libz.so.1
    libdbus-1.so.3 -> found: /nix/store/ddqrvb1b0xdb8g18f4advmq4wk0aiknd-dbus-1.12.16-lib/lib/libdbus-1.so.3
    libGL.so.1 -> found: /nix/store/bbpgyifsh2hv0ivhl3g4ik2nw7d10zdx-emulator-30.0.3/libexec/android-sdk/emulator/lib64/gles_mesa/libGL.so.1
    libc++.so.1 -> found: /nix/store/bbpgyifsh2hv0ivhl3g4ik2nw7d10zdx-emulator-30.0.3/libexec/android-sdk/emulator/lib64/libc++.so.1
```
2020-03-09 04:49:47 +00:00

46 lines
1.4 KiB
Nix

{ deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, pkgs_i686 }:
deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook makeWrapper ]
++ lib.optional (os == "linux") [
pkgs.glibc
pkgs.xlibs.libX11
pkgs.xlibs.libXext
pkgs.xlibs.libXdamage
pkgs.xlibs.libXfixes
pkgs.xlibs.libxcb
pkgs.xlibs.libXcomposite
pkgs.xlibs.libXcursor
pkgs.xlibs.libXi
pkgs.xlibs.libXrender
pkgs.xlibs.libXtst
pkgs.libcxx
pkgs.libGL
pkgs.libpulseaudio
pkgs.zlib
pkgs.ncurses5
pkgs.stdenv.cc.cc
pkgs_i686.glibc
pkgs.expat
pkgs.freetype
pkgs.nss
pkgs.nspr
pkgs.alsaLib
];
patchInstructions = lib.optionalString (os == "linux") ''
addAutoPatchelfSearchPath $packageBaseDir/lib
addAutoPatchelfSearchPath $packageBaseDir/lib64
addAutoPatchelfSearchPath $packageBaseDir/lib64/qt/lib
# autoPatchelf is not detecting libuuid :(
addAutoPatchelfSearchPath ${pkgs.libuuid.out}/lib
autoPatchelf $out
# Wrap emulator so that it can load libdbus-1.so at runtime and it no longer complains about XKB keymaps
wrapProgram $out/libexec/android-sdk/emulator/emulator \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ pkgs.dbus ]} \
--set QT_XKB_CONFIG_ROOT ${pkgs.xkeyboard_config}/share/X11/xkb \
--set QTCOMPOSE ${pkgs.xorg.libX11.out}/share/X11/locale
'';
dontMoveLib64 = true;
}