3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #58143 from worldofpeace/anbox-nits

anbox: cleanup
This commit is contained in:
Gabriel Ebner 2019-03-23 18:34:36 +01:00 committed by GitHub
commit d5a533de97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,11 +16,36 @@
, protobufc
, python
, lxc
, writeText
, writeScript
, runtimeShell
}:
let
dbus-service = writeText "org.anbox.service" ''
[D-BUS Service]
Name=org.anbox
Exec=@out@/libexec/anbox-session-manager
'';
anbox-application-manager = writeScript "anbox-application-manager" ''
#!${runtimeShell}
${systemd}/bin/busctl --user call \
org.freedesktop.DBus \
/org/freedesktop/DBus \
org.freedesktop.DBus \
StartServiceByName "su" org.anbox 0
@out@/bin/anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
'';
in
stdenv.mkDerivation rec {
pname = "anbox";
version = "2019-03-07";
version = "unstable-2019-03-07";
src = fetchFromGitHub {
owner = pname;
@ -29,10 +54,14 @@ stdenv.mkDerivation rec {
sha256 = "1wfx4bsyxvrjl16dq5pqgial8rnnsnxzbak2ap0waddz847czxwz";
};
nativeBuildInputs = [
makeWrapper
];
buildInputs = [
cmake pkgconfig dbus boost libcap gtest systemd mesa glib
SDL2 SDL2_image protobuf protobufc properties-cpp lxc python
makeWrapper libGL
libGL
];
patchPhase = ''
@ -68,31 +97,16 @@ stdenv.mkDerivation rec {
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [libGL libglvnd]} \
--prefix PATH : ${git}/bin
mkdir -p $out/share/dbus-1/services/
cat <<END > $out/share/dbus-1/services/org.anbox.service
[D-BUS Service]
Name=org.anbox
Exec=$out/libexec/anbox-session-manager
END
mkdir -p $out/share/dbus-1/services
substitute ${dbus-service} $out/share/dbus-1/services/org.anbox.service \
--subst-var out
mkdir $out/libexec
cat > $out/libexec/anbox-session-manager <<EOF
#!${stdenv.shell}
exec $out/bin/anbox session-manager
EOF
chmod +x $out/libexec/anbox-session-manager
makeWrapper $out/bin/anbox $out/libexec/anbox-session-manager \
--add-flags session-manager
cat > $out/bin/anbox-application-manager <<EOF
#!${stdenv.shell}
${systemd}/bin/busctl --user call \
org.freedesktop.DBus \
/org/freedesktop/DBus \
org.freedesktop.DBus \
StartServiceByName "su" org.anbox 0
$out/bin/anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
EOF
chmod +x $out/bin/anbox-application-manager
substitute ${anbox-application-manager} $out/bin/anbox-application-manager \
--subst-var out
'';
passthru.image = let
@ -115,7 +129,7 @@ stdenv.mkDerivation rec {
meta = with stdenv.lib; {
homepage = https://anbox.io;
description = "Android in a box.";
description = "Android in a box";
license = licenses.gpl2;
maintainers = with maintainers; [ edwtjo ];
platforms = [ "armv7l-linux" "aarch64-linux" "x86-64-linux" ];