about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/anbox.nix
blob: d78f63ec761fc2be74663a8008647e975cc21fe9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ lib, pkgs, ... }:

{
  name = "anbox";
  meta.maintainers = with lib.maintainers; [ mvnetbiz ];

  nodes.machine = { pkgs, config, ... }: {
    imports = [
      ./common/user-account.nix
      ./common/x11.nix
    ];

    environment.systemPackages = with pkgs; [ android-tools ];

    test-support.displayManager.auto.user = "alice";

    virtualisation.anbox.enable = true;
    boot.kernelPackages = pkgs.linuxPackages_5_15;

    # The AArch64 anbox image will not start.
    # Meanwhile the postmarketOS images work just fine.
    virtualisation.anbox.image = pkgs.anbox.postmarketos-image;
    virtualisation.memorySize = 2500;
  };

  testScript = { nodes, ... }: let
    user = nodes.machine.users.users.alice;
    bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus";
  in ''
    machine.wait_for_x()

    machine.wait_until_succeeds(
        "sudo -iu alice ${bus} anbox wait-ready"
    )

    machine.wait_until_succeeds("adb shell true")

    print(machine.succeed("adb devices"))
  '';
}