{ config, pkgs, ... }:

{
  # Installation and Usage. https://nixos.wiki/wiki/WayDroid
  #
  #   Installation:
  #   Fetch WayDroid images.
  #   You can add the parameters "-s GAPPS -f" to have GApps support.
  #     sudo waydroid init
  #
  #   Usage:
  #   Start the WayDroid LXC container
  #     sudo systemctl start waydroid-container
  #     sudo journalctl -b -u waydroid-container
  #     #=> Started Waydroid Container.
  #   Start WayDroid session
  #   You'll know it is finished when you see the message "Android with user 0 is ready".
  #     waydroid session start
  #   Install and launch F-Droid
  #     curl -L -o ~/Downloads/F-Droid.apk https://f-droid.org/F-Droid.apk
  #     waydroid app install ~/Downloads/F-Droid.apk
  #     waydroid app launch org.fdroid.fdroid
  #   Stop WayDroid session
  #     waydroid session stop
  #   Stop the Waydroid LXC container
  #     sudo systemctl stop waydroid-container

  # TODO: Is WayDroid rooted? How to un-root it?
  # https://github.com/waydroid/waydroid/issues/935

  assertions = [{
    assertion = config.services.xserver.displayManager.gdm.wayland;
    message = "Waydroid requires Wayland.";
  }];

  virtualisation.waydroid.enable = true;

  # Clipboard sharing. https://nixos.wiki/wiki/WayDroid#Clipboard_sharing
  environment.systemPackages = with pkgs; [
    wl-clipboard
  ];
}
