Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions maintainers/team-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,15 @@ with lib.maintainers;
shortName = "Sphinx";
};

stardust-xr = {
members = [
pandapip1
technobaboo
];
scope = "Maintain Stardust XR packgaes";
shortName = "StardustXR";
};

stdenv = {
enableFeatureFreezePing = true;
github = "stdenv";
Expand Down
4 changes: 4 additions & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,10 @@ 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-mail = runTest ./stalwart/stalwart-mail.nix;
stardust-xr-flatland = runTest ./stardust-xr/flatland.nix;
stardust-xr-kiara = runTest ./stardust-xr/kiara.nix;
stardust-xr-sphereland = runTest ./stardust-xr/sphereland.nix;
stardust-xr-atmosphere = runTest ./stardust-xr/atmosphere.nix;
stargazer = runTest ./web-servers/stargazer.nix;
starship = runTest ./starship.nix;
startx = import ./startx.nix { inherit pkgs runTest; };
Expand Down
37 changes: 37 additions & 0 deletions nixos/tests/common/openxr.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
lib,
pkgs,
config,
...
}:

{
imports = [
./user-account.nix
./x11.nix
];
test-support.displayManager.auto.user = "alice";
systemd.user.targets.xdg-desktop-autostart = {
wantedBy = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
};

hardware.graphics.enable = true;

services.monado = {
enable = true;
defaultRuntime = true;
forceDefaultRuntime = true;
};
systemd.user.services.monado = {
requires = [ "graphical-session.target" ];
environment = {
# Stop Monado from probing for any hardware
SIMULATED_ENABLE = "1";
# Run as X11 client rather than using direct mode
XRT_COMPOSITOR_FORCE_XCB = "1";
# And run fullscreen so that we can hide the DE
XRT_COMPOSITOR_XCB_FULLSCREEN = "1";
};
};
}
74 changes: 42 additions & 32 deletions nixos/tests/monado.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,57 @@
name = "monado";

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

{
hardware.graphics.enable = true;
users.users.alice = {
isNormalUser = true;
uid = 1000;
imports = [ ./common/openxr.nix ];

systemd.user.services.print-openxr-info = {
wantedBy = [ "xdg-desktop-autostart.target" ];
requires = [ "monado.service" ];
script = lib.getExe' pkgs.openxr-loader "openxr_runtime_list";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
};

services.monado = {
enable = true;
defaultRuntime = true;

forceDefaultRuntime = true;
systemd.user.services.xrgears = {
wantedBy = [ "xdg-desktop-autostart.target" ];
requires = [ "monado.service" ];
script = lib.getExe pkgs.xrgears;
};
# 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
''
# for defaultRuntime
machine.succeed("stat /etc/xdg/openxr/1/active_runtime.json")

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")

# for forceDefaultRuntime
machine.succeed("stat /home/alice/.config/openxr/1/active_runtime.json")

machine.succeed("su -- alice -c env XDG_RUNTIME_DIR=${runtimePath} openxr_runtime_list")
with subtest("Ensure X11 starts"):
start_all()
machine.succeed("loginctl enable-linger alice")
machine.wait_for_x()

with subtest("Ensure default runtime present"):
machine.succeed("stat /etc/xdg/openxr/1/active_runtime.json")

with subtest("Ensure forced runtime present"):
# Monado needs to be started to create the forced runtime file
machine.systemctl("start monado.service", "alice")
machine.wait_for_unit("monado.service", "alice")
machine.succeed("stat /home/alice/.config/openxr/1/active_runtime.json")

with subtest("Ensure openxr_runtime_list can find runtime"):
machine.wait_for_unit("print-openxr-info.service", "alice")

with subtest("Ensure xrgears launches"):
machine.wait_for_unit("xrgears.service", "alice")
# TODO: 10 seconds should be long enough for anything, but this is theoretically flaky
machine.sleep(10)
machine.screenshot("screen")
'';
}
49 changes: 49 additions & 0 deletions nixos/tests/stardust-xr/atmosphere.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ ... }:
{
name = "stardust-xr-atmosphere";

# Doesn't understand @polling_condition
skipTypeCheck = true;

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

{
imports = [ ./common.nix ];

systemd.user.services.stardust-xr-atmosphere = {
wantedBy = [ "xdg-desktop-autostart.target" ];
requires = [ "stardust-xr-server.service" ];
after = [ "stardust-xr-server.service" ];
script = ''
${lib.getExe pkgs.stardust-xr-atmosphere} install ${pkgs.srcOnly pkgs.stardust-xr-atmosphere}/default_envs/the_grid
${lib.getExe pkgs.stardust-xr-atmosphere} show the_grid
'';
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: 10 seconds should be long enough for anything, but this is theoretically flaky
machine.sleep(10)
machine.screenshot("screen")
'';
}
20 changes: 20 additions & 0 deletions nixos/tests/stardust-xr/common.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
lib,
pkgs,
...
}:

{
imports = [ ../common/openxr.nix ];

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";
};
}
53 changes: 53 additions & 0 deletions nixos/tests/stardust-xr/flatland.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{ ... }:
{
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.weston "weston-presentation-shm"} -i";
};
};

testScript =
{ nodes, ... }:
''
@polling_condition()
def wayland_client_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 wayland_client_running:
# TODO: 10 seconds should be long enough for anything, but this is theoretically flaky
machine.sleep(10)
machine.screenshot("screen")
'';
}
53 changes: 53 additions & 0 deletions nixos/tests/stardust-xr/kiara.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{ ... }:
{
name = "stardust-xr-kiara";

# Doesn't understand @polling_condition
skipTypeCheck = true;

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

{
imports = [ ./common.nix ];

systemd.user.services.stardust-xr-kiara = {
wantedBy = [ "xdg-desktop-autostart.target" ];
requires = [ "stardust-xr-server.service" ];
after = [ "stardust-xr-server.service" ];
script = lib.getExe pkgs.stardust-xr-kiara;
environment.RUST_BACKTRACE = "full";
};

systemd.user.services.test-wayland-app = {
wantedBy = [ "xdg-desktop-autostart.target" ];
requires = [ "stardust-xr-kiara.service" ];
after = [ "stardust-xr-kiara.service" ];
script = "${lib.getExe' pkgs.weston "weston-presentation-shm"} -i";
};
};

testScript =
{ nodes, ... }:
''
@polling_condition()
def wayland_client_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 wayland_client_running:
# TODO: 10 seconds should be long enough for anything, but this is theoretically flaky
machine.sleep(10)
machine.screenshot("screen")
'';
}
54 changes: 54 additions & 0 deletions nixos/tests/stardust-xr/sphereland.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{ ... }:
{
name = "stardust-xr-flatland";

# Doesn't understand @polling_condition
skipTypeCheck = true;

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

{
imports = [ ./common.nix ];

systemd.user.services.stardust-xr-sphereland = {
wantedBy = [ "xdg-desktop-autostart.target" ];
requires = [ "stardust-xr-server.service" ];
after = [ "stardust-xr-server.service" ];
script = lib.getExe pkgs.stardust-xr-sphereland;
environment.RUST_BACKTRACE = "full";
};

systemd.user.services.test-wayland-app = {
wantedBy = [ "xdg-desktop-autostart.target" ];
requires = [ "stardust-xr-sphereland.service" ];
after = [ "stardust-xr-sphereland.service" ];
script = "${lib.getExe' pkgs.weston "weston-presentation-shm"} -i";
};
};

testScript =
{ nodes, ... }:
''
@polling_condition()
def wayland_client_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 wayland_client_running:
# TODO: 10 seconds should be long enough for anything, but this is theoretically flaky
machine.sleep(10)
# TODO: window is currently off the screen
machine.screenshot("screen")
'';
}
Loading
Loading