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