Waydroid: Difference between revisions
Tag: Undo |
|||
(10 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
[https://waydro.id Waydroid] is an application which uses LXC containers to run Android applications on a non-Android system. | [https://waydro.id Waydroid] is an application which uses LXC containers to run Android applications on a non-Android system. | ||
{{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].}} | ||
{{Warning|Installing Waydroid on your system before running nixos-generate-config will create unnecessary fstab entries that may interfere with system functionality.}} | {{Warning|Installing Waydroid on your system before running nixos-generate-config will create unnecessary fstab entries that may interfere with system functionality.}} | ||
Line 36: | Line 36: | ||
You'll know it worked by checking the journal You should see "Started Waydroid Container". | You'll know it worked by checking the journal You should see "Started Waydroid Container". | ||
$ sudo journalctl -u waydroid-container | $ sudo journalctl -u waydroid-container -e | ||
Start Waydroid session | Start Waydroid session | ||
Line 98: | Line 98: | ||
$ sudo rm -r /var/lib/waydroid/* ~/.local/share/waydroid | $ sudo rm -r /var/lib/waydroid/* ~/.local/share/waydroid | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Tips and tricks == | |||
=== Mount host directories === | |||
{{Warning|Parts of this instruction will only work with the latest waydroid-helper package in NixOS master and will be available with the next release 25.11}}Install and configure graphical application <code>waydroid-helper</code><syntaxhighlight lang="nix"> | |||
systemd.packages = [ pkgs.waydroid-helper ]; | |||
environment.systemPackages = [ pkgs.waydroid-helper ]; | |||
systemd = { | |||
packages = [ pkgs.waydroid-helper ]; | |||
services.waydroid-mount.wantedBy = [ "multi‑user.target" ]; | |||
}; | |||
</syntaxhighlight>Enable the user service which is also required. Note that this is not persistent and needs to get started after reboot again.<syntaxhighlight lang="bash"> | |||
systemctl --user start waydroid-monitor | |||
</syntaxhighlight>Now start <code>waydroid-helper</code> application and add a shared directory. As an example, source directory could be <code>/home/myuser/Public</code> and target directory <code>/home/myuser/.local/share/waydroid/data/media/0/NixOS</code>. Ensure that both directories already exist locally. After that you might need to restart the ''Waydroid'' container which is also possible with the graphical user interface. | |||
=== GPS/Location forwarding === | |||
First enable ''geoclue2'' and ''adb'' daemon on the host<syntaxhighlight lang="nix"> | |||
services.geoclue2.enable = true; | |||
programs.adb.enable = true; | |||
</syntaxhighlight>Enable location provider in your desktop environment. For Gnome Shell you can do this<syntaxhighlight lang="bash"> | |||
gsettings set org.gnome.system.location enabled true | |||
</syntaxhighlight>To test and see location<syntaxhighlight lang="bash"> | |||
nix shell nixpkgs#geoclue2 -c $(nix eval --raw nixpkgs#geoclue2)/libexec/geoclue-2.0/demos/where-am-i | |||
</syntaxhighlight>Get IP address of the Waydroid guest and connect ''adb'' to it<syntaxhighlight lang="bash"> | |||
waydroid shell ip addr show | |||
adb connect <IP>:5555 | |||
</syntaxhighlight>Download, initialize and run geobridge script<syntaxhighlight lang="bash"> | |||
wget https://gitlab.com/papiris/geobridge/-/raw/main/geobridge.sh | |||
sh geobridge.sh --init | |||
</syntaxhighlight> | |||
=== Notification forwarding === | |||
To forward notifications from the Waydroid container to the host system, [[KDE Connect]] can be used. | |||
On a Gnome-desktop, add following to your system config and enable:<syntaxhighlight lang="nix"> | |||
programs.kdeconnect = { | |||
enable = true; | |||
package = pkgs.gnomeExtensions.gsconnect; | |||
}; | |||
</syntaxhighlight>Open the application ''Extensions'' and enable ''Gsconnect'' plugin there. | |||
Inside the Waydroid container, follow these steps: | |||
* Download and install the [https://f-droid.org/en/packages/org.kde.kdeconnect_tp/ KDE Connect app] | |||
* Open the app and and start pairing with the host machine | |||
* You'll have to enable access to notifications by clicking on the corresponding entry in the permissions list inside the app | |||
* If you get the system message "''Restricted setting / For your security, this setting is currently unavailable''", you'll have to enable restricted settings. Go to Android settings app, in the apps list select KDE connect and click in the upper right corner on the three dot menu to ''Allow restricted settings'' | |||
* You may have to reboot the Waydroid container for notification forward to work. | |||
== Troubleshooting == | == Troubleshooting == |