about summary refs log tree commit diff
path: root/nixos/tests/monado.nix
blob: 8368950951e7355746133665ac763219c22803b0 (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
import ./make-test-python.nix ({ pkgs, ... }: {
  name = "monado";

  nodes.machine =
    { pkgs, ... }:

    {
      hardware.opengl.enable = true;
      users.users.alice = {
        isNormalUser = true;
        uid = 1000;
      };

      services.monado = {
        enable = true;
        defaultRuntime = true;
      };
      # Stop Monado from probing for any hardware
      systemd.user.services.monado.environment.SIMULATED_ENABLE = "1";

      environment.systemPackages = with pkgs; [ openxr-loader ];
    };

  testScript = { nodes, ... }:
    let
      userId = toString nodes.machine.users.users.alice.uid;
      runtimePath = "/run/user/${userId}";
    in
    ''
      machine.succeed("loginctl enable-linger alice")
      machine.wait_for_unit("user@${userId}.service")

      machine.wait_for_unit("monado.socket", "alice")
      machine.systemctl("start monado.service", "alice")
      machine.wait_for_unit("monado.service", "alice")

      machine.succeed("su -- alice -c env XDG_RUNTIME_DIR=${runtimePath} openxr_runtime_list")
    '';
})