diff mbox series

[bug#51737,4/4] gnu: Add waydroid.

Message ID 5RLyma8o5V0_Xhn_sSJGxZYF4XMzJtrEna-xE5UU-suoRiBa7vaxBdDUEBgKSBMb94O68CnqEzPkcuFA4qasS4rHR4lh-ch-S1k-mFn6d4U=@protonmail.com
State New
Headers show
Series [bug#51737,1/4] gnu: Add libglibutil. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

phodina Nov. 10, 2021, 1:39 a.m. UTC
* gnu/packages/virtualization.scm (waydroid): New variable.

--
2.33.1

Comments

Liliana Marie Prikler Nov. 15, 2021, 8:03 p.m. UTC | #1
Hi,

Am Mittwoch, den 10.11.2021, 01:39 +0000 schrieb phodina:
> [...]
> +    (description "Waydroid uses Linux namespaces @code{(user, pid,
> uts, net,
> +mount, ipc)} to run a full Android system in a container and provide
> Android
> +applications.  The Android inside the container has direct access to
> needed
> +underlying hardware.  The Android runtime environment ships with a
> minimal
> +customized Android system image based on LineageOS.  The used image
> is
> +currently based on Android 10.")
How exactly/when is this RTE built?  Is it just included as a blob?
phodina Nov. 15, 2021, 10:30 p.m. UTC | #2
Hi Liliana,

On Monday, November 15th, 2021 at 9:03 PM, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

> Hi,
>
> Am Mittwoch, den 10.11.2021, 01:39 +0000 schrieb phodina:
>
> > [...]
> >
> > -   (description "Waydroid uses Linux namespaces @code{(user, pid,
> >
> >     uts, net,
> >
> >     +mount, ipc)} to run a full Android system in a container and provide
> >
> >     Android
> >
> >     +applications. The Android inside the container has direct access to
> >
> >     needed
> >
> >     +underlying hardware. The Android runtime environment ships with a
> >
> >     minimal
> >
> >     +customized Android system image based on LineageOS. The used image
> >
> >     is
> >
> >     +currently based on Android 10.")
>
> How exactly/when is this RTE built? Is it just included as a blob?

Nope, it's downloaded as part of the =waydroid init= command.

You can see the RTE here:
$ ls /var/lib/waydroid/images/
system.img  vendor.img

On waydroid website [1] they provide instructions on how to create this runtime environment - basically "+-" Android rootfs.

I cameacross a channel [2] with Android support but haven't had the chance to test it yet. Then again I'm not sure if that's the right way as there are phones that run close to vanilla Linux [3]. Though this technological solution enables Android apps to run on those phones.

But it also has drawback as it requires custom kernel.

Though these patches require support in the kernel [3] and LXD service running [4] at least.

Currently I'm able to run the waydroid container and get shell over adb.

However, for some unknown reason I can't launch the UI.

That might be due to the fact I run Sway VM. I'll test this with GDM as this is recommended in the issues on github and report back.

Petr

[1]: https://docs.waydro.id/development/compile-waydroid-lineage-os-based-images
[2]: https://framagit.org/tyreunom/guix-android
[3]: https://postmarketos.org/
[4]: https://issues.guix.gnu.org/51771
[5]: https://issues.guix.gnu.org/50133
phodina Dec. 3, 2021, 3 p.m. UTC | #3
ping
diff mbox series

Patch

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 1817f6dc22..d47d8402f6 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -2005,6 +2005,72 @@  (define-public bochs
 DOS or Microsoft Windows.")
     (license license:lgpl2.0+)))

+(define-public waydroid
+  (package
+    (name "waydroid")
+    (version "1.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/waydroid/waydroid")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "03d87sh443kn0j2mpih1g909khkx3wgb04h605f9jhd0znskkbmw"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'build)                ; no setup.py
+         (delete 'check)                ; no test suite
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib/waydroid"))
+                    (tools (string-append lib "/tools"))
+                    (data (string-append lib "/data"))
+                    (apps (string-append out "/share/applications"))
+                    (bin (string-append out "/bin"))
+                    (site (string-append out "/lib/python"
+                                         ,(version-major+minor
+                                           (package-version python))
+                                         "/site-packages"))
+                    (path (getenv "PYTHONPATH")))
+               (mkdir-p tools)
+               (mkdir-p data)
+               (mkdir-p apps)
+               (mkdir-p bin)
+               (copy-recursively "tools" tools)
+               (copy-recursively "data" data)
+               (install-file (string-append data "/Waydroid.desktop")
+                             (string-append apps))
+               (substitute* (string-append apps "/Waydroid.desktop")
+                 (("/usr") lib))
+               (install-file "waydroid.py" lib)
+               (symlink (string-append lib "/waydroid.py") (string-append bin
+                                                                          "/waydroid.py"))
+               (wrap-program (string-append bin "/waydroid.py")
+                 `("PYTHONPATH" ":" prefix (,site ,path)))))))))
+    (inputs `(("bash-minimal" ,bash-minimal)
+              ("dnsmasq" ,dnsmasq)
+              ("libgbinder" ,libgbinder)
+              ("lxc" ,lxc)
+              ("nftables" ,nftables)
+              ("python" ,python)
+              ("python-gbinder" ,python-gbinder)
+              ("python-pygobject" ,python-pygobject)))
+    (home-page "https://waydro.id")
+    (synopsis "Container-based approach to boot a full Android system")
+    (description "Waydroid uses Linux namespaces @code{(user, pid, uts, net,
+mount, ipc)} to run a full Android system in a container and provide Android
+applications.  The Android inside the container has direct access to needed
+underlying hardware.  The Android runtime environment ships with a minimal
+customized Android system image based on LineageOS.  The used image is
+currently based on Android 10.")
+    (license license:gpl3)))
+
 (define-public xen
   (package
     (name "xen")