2024-10-15 15:25:28 +00:00
|
|
|
import ./make-test-python.nix (
|
2024-10-15 15:33:11 +00:00
|
|
|
{ ... }:
|
2024-10-15 15:25:28 +00:00
|
|
|
{
|
|
|
|
name = "monado";
|
2023-12-18 16:48:48 +00:00
|
|
|
|
2024-10-15 15:25:28 +00:00
|
|
|
nodes.machine =
|
|
|
|
{ pkgs, ... }:
|
2023-12-18 16:48:48 +00:00
|
|
|
|
2024-10-15 15:25:28 +00:00
|
|
|
{
|
|
|
|
hardware.graphics.enable = true;
|
|
|
|
users.users.alice = {
|
|
|
|
isNormalUser = true;
|
|
|
|
uid = 1000;
|
|
|
|
};
|
2023-12-18 16:48:48 +00:00
|
|
|
|
2024-10-15 15:25:28 +00:00
|
|
|
services.monado = {
|
|
|
|
enable = true;
|
|
|
|
defaultRuntime = true;
|
2024-10-15 15:33:11 +00:00
|
|
|
|
|
|
|
forceDefaultRuntime = true;
|
2024-10-15 15:25:28 +00:00
|
|
|
};
|
|
|
|
# Stop Monado from probing for any hardware
|
|
|
|
systemd.user.services.monado.environment.SIMULATED_ENABLE = "1";
|
2023-12-18 16:48:48 +00:00
|
|
|
|
2024-10-15 15:25:28 +00:00
|
|
|
environment.systemPackages = with pkgs; [ openxr-loader ];
|
|
|
|
};
|
2023-12-18 16:48:48 +00:00
|
|
|
|
2024-10-15 15:25:28 +00:00
|
|
|
testScript =
|
|
|
|
{ nodes, ... }:
|
|
|
|
let
|
|
|
|
userId = toString nodes.machine.users.users.alice.uid;
|
|
|
|
runtimePath = "/run/user/${userId}";
|
|
|
|
in
|
|
|
|
''
|
2024-10-15 15:33:11 +00:00
|
|
|
# for defaultRuntime
|
|
|
|
machine.succeed("stat /etc/xdg/openxr/1/active_runtime.json")
|
|
|
|
|
2024-10-15 15:25:28 +00:00
|
|
|
machine.succeed("loginctl enable-linger alice")
|
|
|
|
machine.wait_for_unit("user@${userId}.service")
|
2023-12-18 16:48:48 +00:00
|
|
|
|
2024-10-15 15:25:28 +00:00
|
|
|
machine.wait_for_unit("monado.socket", "alice")
|
|
|
|
machine.systemctl("start monado.service", "alice")
|
|
|
|
machine.wait_for_unit("monado.service", "alice")
|
2023-12-18 16:48:48 +00:00
|
|
|
|
2024-10-15 15:33:11 +00:00
|
|
|
# for forceDefaultRuntime
|
|
|
|
machine.succeed("stat /home/alice/.config/openxr/1/active_runtime.json")
|
|
|
|
|
2024-10-15 15:25:28 +00:00
|
|
|
machine.succeed("su -- alice -c env XDG_RUNTIME_DIR=${runtimePath} openxr_runtime_list")
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
)
|