1import ./make-test-python.nix (
2 { ... }:
3 {
4 name = "monado";
5
6 nodes.machine =
7 { pkgs, ... }:
8
9 {
10 hardware.graphics.enable = true;
11 users.users.alice = {
12 isNormalUser = true;
13 uid = 1000;
14 };
15
16 services.monado = {
17 enable = true;
18 defaultRuntime = true;
19
20 forceDefaultRuntime = true;
21 };
22 # Stop Monado from probing for any hardware
23 systemd.user.services.monado.environment.SIMULATED_ENABLE = "1";
24
25 environment.systemPackages = with pkgs; [ openxr-loader ];
26 };
27
28 testScript =
29 { nodes, ... }:
30 let
31 userId = toString nodes.machine.users.users.alice.uid;
32 runtimePath = "/run/user/${userId}";
33 in
34 ''
35 # for defaultRuntime
36 machine.succeed("stat /etc/xdg/openxr/1/active_runtime.json")
37
38 machine.succeed("loginctl enable-linger alice")
39 machine.wait_for_unit("user@${userId}.service")
40
41 machine.wait_for_unit("monado.socket", "alice")
42 machine.systemctl("start monado.service", "alice")
43 machine.wait_for_unit("monado.service", "alice")
44
45 # for forceDefaultRuntime
46 machine.succeed("stat /home/alice/.config/openxr/1/active_runtime.json")
47
48 machine.succeed("su -- alice -c env XDG_RUNTIME_DIR=${runtimePath} openxr_runtime_list")
49 '';
50 }
51)