Waydroid: Difference between revisions
Tag: Undo |
→V4L2 camera forwarding: Simplify setup instructions |
||
| (20 intermediate revisions by 7 users not shown) | |||
| Line 2: | Line 2: | ||
{{Warning|Waydroid requires a [[Wayland]] desktop session and cannot be used on X11 directly, but can be run in a nested [[Wayland]] session, using e.g. [https://www.hjdskes.nl/projects/cage cage].}} | {{Warning|Waydroid requires a [[Wayland]] desktop session and cannot be used on X11 directly, but can be run in a nested [[Wayland]] session, using e.g. [https://www.hjdskes.nl/projects/cage cage].}} | ||
== Installation == | == Installation == | ||
{{Warning|Installing Waydroid on your system before running nixos-generate-config will create unnecessary fstab entries that may interfere with system functionality.}} | |||
Enable Waydroid in your system configuration: | Enable Waydroid in your system configuration: | ||
| Line 11: | Line 12: | ||
{ | { | ||
virtualisation.waydroid.enable = true; | virtualisation.waydroid.enable = true; | ||
# Newer kernel versions may need | |||
virtualisation.waydroid.package = pkgs.waydroid-nftables; | |||
# Enable clipboard sharing | |||
environment.systemPackages = [ pkgs.wl-clipboard ]; | |||
} | } | ||
</nowiki>}} | </nowiki>|name=|lang=}} | ||
| Line 29: | Line 35: | ||
== Usage == | == Usage == | ||
Start the container | Start the container and userspace Wayland session. You'll know it is finished when you see the message "Android with user 0 is ready". | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
$ sudo systemctl start waydroid-container | $ sudo systemctl start waydroid-container | ||
$ waydroid session start | $ waydroid session start | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 64: | Line 63: | ||
$ waydroid prop set persist.waydroid.width 608 | $ waydroid prop set persist.waydroid.width 608 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Maintenance == | == Maintenance == | ||
| Line 102: | Line 90: | ||
=== Mount host directories === | === Mount host directories === | ||
Install and configure graphical application <code>waydroid-helper</code><syntaxhighlight lang="nix"> | |||
environment.systemPackages = [ pkgs.waydroid-helper ]; | environment.systemPackages = [ pkgs.waydroid-helper ]; | ||
systemd = { | systemd = { | ||
packages = [ pkgs.waydroid-helper ]; | packages = [ pkgs.waydroid-helper ]; | ||
services.waydroid-mount.wantedBy = [ " | services.waydroid-mount.wantedBy = [ "multi-user.target" ]; | ||
}; | }; | ||
| Line 116: | Line 104: | ||
=== GPS/Location forwarding === | === GPS/Location forwarding === | ||
First enable ''geoclue2'' and ''adb'' daemon on the host<syntaxhighlight lang="nix"> | First enable ''geoclue2'' and ''adb'' daemon on the host<syntaxhighlight lang="nix"> | ||
services.geoclue2.enable = true; | services.geoclue2.enable = true; | ||
| Line 131: | Line 120: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== | === V4L2 camera forwarding === | ||
Camera forwarding using V4L2 is broken on upstream, but can be achieved by using the Waydroid images of the [https://github.com/WayDroid-ATV Waydroid-ATV project]. You might [[Waydroid#Resetting Android Container|need to reset]] your existing Waydroid environment. Then stop the container and fetch the latest Waydroid-ATV images.<syntaxhighlight lang="bash"> | |||
systemctl stop waydroid-container | |||
waydroid init -f \ | |||
-c https://waydroid-atv.github.io/ota/a16-qpr2/system \ | |||
-v https://waydroid-atv.github.io/ota/a16-qpr2/vendor \ | |||
-r lineage \ | |||
-s GAPPS | |||
systemctl start waydroid-container | |||
waydroid session start | |||
</syntaxhighlight>In case the graphical interface wont show up or the setup wizard fails you can do<syntaxhighlight lang="bash"> | |||
waydroid shell -- am start -a android.intent.action.MAIN -c android.intent.category.HOME | |||
waydroid shell -- pm disable-user --user 0 com.google.android.setupwizard | |||
waydroid shell -- pm disable-user --user 0 com.google.android.gms.setup | |||
</syntaxhighlight>In case the camera access will crash the Waydroid container, there's a recent image which solves this on AMD GPUs. Download it and extract the contents to <code>/etc/waydroid-extra/images</code>. After that recreate the environment as mentioned above but only issue <code>waydroid init -f</code>. | |||
=== Running applications that differ from the current host architecture via libhoudini or libndk<ref>Need help with activating libhoudini for waydroid on NixOS | |||
https://www.reddit.com/r/NixOS/comments/15k2jxc/need_help_with_activating_libhoudini_for_waydroid/</ref> === | |||
Run <code>nix shell github:nix-community/NUR#repos.ataraxiasjel.waydroid-script -c sudo waydroid-script</code> | |||
</ | |||
Or, alternatively, add <code>nur.repos.ataraxiasjel.waydroid-script</code> from the NUR to your flake or shell or NixOS <code>environment.systemPackages</code>, or HM <code>home.packages</code> or something like that based on [https://github.com/nix-community/NUR readme] and run <code>sudo waydroid-script</code> | |||
In the TUI, select Android 13 > Install > libhoudini (or libndk, [https://github.com/casualsnek/waydroid_script/blob/fcb15624db0811615ea9800837a836c4777674bf/README.md#install-libndk-arm-translation which script author claims may be faster on AMD]) | |||
== Troubleshooting == | == Troubleshooting == | ||
| Line 158: | Line 157: | ||
ro.hardware.egl=swiftshader | ro.hardware.egl=swiftshader | ||
</nowiki>}} | </nowiki>}} | ||
==See Also:== | ==See Also:== | ||
* [https://wiki.archlinux.org/title/Waydroid Waydroid article on the Archlinux Wiki] | * [https://wiki.archlinux.org/title/Waydroid Waydroid article on the Archlinux Wiki] | ||