From 020d4389018295feed4b3c27ef2fc0e436f8f80d Mon Sep 17 00:00:00 2001 From: Gavin John Date: Wed, 29 Oct 2025 01:51:50 -0700 Subject: [PATCH] nixosTests/stardust-xr-{atmosphere,flatland}: init --- nixos/tests/all-tests.nix | 2 + nixos/tests/stardust-xr/atmosphere.nix | 54 ++++++++++++++++++++++++ nixos/tests/stardust-xr/common.nix | 23 +++++++++++ nixos/tests/stardust-xr/flatland.nix | 57 ++++++++++++++++++++++++++ 4 files changed, 136 insertions(+) create mode 100644 nixos/tests/stardust-xr/atmosphere.nix create mode 100644 nixos/tests/stardust-xr/common.nix create mode 100644 nixos/tests/stardust-xr/flatland.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 310d43533c31..4edd8333c0d6 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1582,6 +1582,8 @@ in sssd-ldap = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./sssd-ldap.nix { }; sssd-legacy-config = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./sssd-legacy-config.nix { }; stalwart = runTest ./stalwart/stalwart.nix; + stardust-xr-atmosphere = runTest ./stardust-xr/atmosphere.nix; + stardust-xr-flatland = runTest ./stardust-xr/flatland.nix; stargazer = runTest ./web-servers/stargazer.nix; starship = runTest ./starship.nix; startx = import ./startx.nix { inherit pkgs runTest; }; diff --git a/nixos/tests/stardust-xr/atmosphere.nix b/nixos/tests/stardust-xr/atmosphere.nix new file mode 100644 index 000000000000..7eb2f7b2778e --- /dev/null +++ b/nixos/tests/stardust-xr/atmosphere.nix @@ -0,0 +1,54 @@ +{ ... }: +{ + name = "stardust-xr-atmosphere"; + + # Doesn't understand @polling_condition + skipTypeCheck = true; + + nodes.machine = + { + lib, + pkgs, + config, + ... + }: + + { + imports = [ ./common.nix ]; + + virtualisation.memorySize = 4096; + + systemd.user.services.stardust-xr-atmosphere = { + wantedBy = [ "xdg-desktop-autostart.target" ]; + requires = [ "stardust-xr-server.service" ]; + after = [ "stardust-xr-server.service" ]; + script = '' + set -eufx pipefail + ${lib.getExe pkgs.stardust-xr-atmosphere} install ${pkgs.stardust-xr-atmosphere}/share/atmosphere/default_envs/the_grid + ${lib.getExe pkgs.stardust-xr-atmosphere} set-default the_grid + ${lib.getExe pkgs.stardust-xr-atmosphere} show + ''; + environment.RUST_BACKTRACE = "full"; + }; + }; + + testScript = + { nodes, ... }: + '' + @polling_condition() + def atmosphere_running(): + machine.wait_for_unit("stardust-xr-atmosphere.service", "alice") + + with subtest("Ensure X11 starts"): + start_all() + machine.succeed("loginctl enable-linger alice") + machine.wait_for_x() + + with subtest("Ensure system works"): + with atmosphere_running: + # TODO(@Pandapip1): 20 seconds should be long enough for anything, but this is theoretically flaky + # Adding systemd notify support to stardust-xr-atmosphere should resolve this + machine.sleep(20) + machine.screenshot("screen") + ''; +} diff --git a/nixos/tests/stardust-xr/common.nix b/nixos/tests/stardust-xr/common.nix new file mode 100644 index 000000000000..bbc5af59b772 --- /dev/null +++ b/nixos/tests/stardust-xr/common.nix @@ -0,0 +1,23 @@ +{ + lib, + pkgs, + ... +}: + +{ + imports = [ ../common/openxr.nix ]; + + # TODO(@Pandapip1): For the time being, Stardust doesn't like controllers rather than hand tracking + services.monado.enable = lib.mkForce false; + + systemd.user.services.stardust-xr-server = { + wantedBy = [ "xdg-desktop-autostart.target" ]; + # requires = [ "monado.service" ]; + serviceConfig = { + Type = "notify"; + NotifyAccess = "all"; + ExecStart = "${lib.getExe pkgs.stardust-xr-server} -e ${pkgs.writeShellScript "notifyReady" "systemd-notify --ready"}"; + }; + environment.RUST_BACKTRACE = "full"; + }; +} diff --git a/nixos/tests/stardust-xr/flatland.nix b/nixos/tests/stardust-xr/flatland.nix new file mode 100644 index 000000000000..748a1e0cbd84 --- /dev/null +++ b/nixos/tests/stardust-xr/flatland.nix @@ -0,0 +1,57 @@ +{ ... }: +{ + name = "stardust-xr-flatland"; + + # Doesn't understand @polling_condition + skipTypeCheck = true; + + nodes.machine = + { + lib, + pkgs, + config, + ... + }: + + { + imports = [ ./common.nix ]; + + systemd.user.services.stardust-xr-flatland = { + wantedBy = [ "xdg-desktop-autostart.target" ]; + requires = [ "stardust-xr-server.service" ]; + after = [ "stardust-xr-server.service" ]; + script = lib.getExe pkgs.stardust-xr-flatland; + environment.RUST_BACKTRACE = "full"; + }; + + systemd.user.services.test-wayland-app = { + wantedBy = [ "xdg-desktop-autostart.target" ]; + requires = [ "stardust-xr-flatland.service" ]; + after = [ "stardust-xr-flatland.service" ]; + script = lib.getExe pkgs.wayland-colorbar; + environment = { + DISPLAY = ""; + WAYLAND_DISPLAY = "wayland-0"; + }; + }; + }; + + testScript = + { nodes, ... }: + '' + @polling_condition() + def wayland_client_running(): + machine.wait_for_unit("test-wayland-app.service", "alice") + + with subtest("Ensure X11 starts"): + start_all() + machine.succeed("loginctl enable-linger alice") + machine.wait_for_x() + + with subtest("Ensure system works"): + with wayland_client_running: + # TODO: 20 seconds should be long enough for anything, but this is theoretically flaky + machine.sleep(20) + machine.screenshot("screen") + ''; +}