Skip to content

Instantly share code, notes, and snippets.

@newtolinux23
Last active September 17, 2025 13:42
Show Gist options
  • Select an option

  • Save newtolinux23/522755a66d8ebd7eed1b3c410bc4319d to your computer and use it in GitHub Desktop.

Select an option

Save newtolinux23/522755a66d8ebd7eed1b3c410bc4319d to your computer and use it in GitHub Desktop.
WayDroid is an application that uses LXC containers to run Android applications on a non-Android system. This document outlines the steps I took to install WayDroid on NixOS, the challenges I faced, and the reasons for choosing WayDroid.

Installing WayDroid on NixOS

https://cdn.wccftech.com/wp-content/uploads/2024/07/waydroid-art-HD-728x340.jpg

Table of Contents

Introduction

WayDroid is an application that uses LXC containers to run Android applications on a non-Android system. This document outlines the steps I took to install WayDroid on NixOS, the challenges I faced, and the reasons for choosing WayDroid.

Installation Steps

Enable WayDroid

To enable WayDroid in your NixOS configuration, add the following line to your /etc/nixos/configuration.nix file:

{
  virtualisation.waydroid.enable = true;
}

Rebuild and Switch System

Rebuild your NixOS configuration and switch to the new configuration:

sudo nixos-rebuild switch

Initialize WayDroid

In your shell, fetch WayDroid images. To include Google Apps (GApps) support, add the parameters -s GAPPS -f:

sudo waydroid init

Challenges Faced

Wayland Requirement

WayDroid requires a Wayland desktop session and cannot be directly used on X11. I had to set up a nested Wayland session using tools like cage.

GPU Adjustments

For my NVIDIA GPU, I needed to disable GBM and mesa-drivers by modifying /var/lib/waydroid/waydroid_base.prop:

ro.hardware.gralloc=default
ro.hardware.egl=swiftshader

Reasons for Using WayDroid

Application Compatibility

WayDroid allows running Android applications seamlessly on a non-Android system, providing access to a wide range of apps.

Integration with NixOS

WayDroid integrates well with NixOS, leveraging the power of Nix’s declarative configuration management.

Rebuilding with Nix Flakes

Initialize Nix Flakes

Ensure Nix flakes are enabled by adding the following to your /etc/nixos/configuration.nix:

{
  nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

Rebuild with Nix Flakes

Rebuild your NixOS configuration using flakes:

nixos-rebuild switch --flake .

Usage Commands

Start WayDroid Container

sudo systemctl start waydroid-container

Confirm the container has started:

sudo journalctl -u waydroid-container

Start WayDroid Session

Start the WayDroid session:

waydroid session start

General Usage

Start Android UI

waydroid show-full-ui

List Installed Android Apps

waydroid app list

Launch an Android App

waydroid app launch <application name>

Install an Android App from APK

waydroid app install </path/to/app.apk>

Enter the LXC Shell

sudo waydroid shell

Override Full-UI Width

waydroid prop set persist.waydroid.width 608

Maintenance

Update Android

sudo waydroid upgrade

Resetting Android Container

sudo systemctl stop waydroid-container
sudo rm -r /var/lib/waydroid/* ~/.local/share/waydroid

Troubleshooting

GPU Adjustments

For NVIDIA or RX 6800 series GPUs:

ro.hardware.gralloc=default
ro.hardware.egl=swiftshader

Linux 5.18+ Compatibility

Enable memfd:

sys.use_memfd=true

Keyboard Layout Issues

Changing the keyboard layout is currently not supported.

UTF-8 Support

Android might fail to display special characters correctly.

Interference with Suspend/Hibernation

Stop the Android session and container to suspend correctly.

Clipboard Sharing

Add wl-clipboard to environment.systemPackages.

For more detailed information, refer to the WayDroid article on the Archlinux Wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment