Skip to content

Commit d46ba76

Browse files
authored
stardust-xr-*: <many> -> 0.51.1 & various improvements (#457027)
2 parents ebac056 + 020d438 commit d46ba76

21 files changed

Lines changed: 519 additions & 287 deletions

File tree

maintainers/team-list.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,15 @@ with lib.maintainers;
717717
github = "security-review";
718718
};
719719

720+
stardust-xr = {
721+
members = [
722+
pandapip1
723+
technobaboo
724+
];
725+
scope = "Maintain Stardust XR packages";
726+
shortName = "StardustXR";
727+
};
728+
720729
stdenv = {
721730
enableFeatureFreezePing = true;
722731
github = "stdenv";

nixos/tests/all-tests.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,8 @@ in
15861586
sssd-ldap = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./sssd-ldap.nix { };
15871587
sssd-legacy-config = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./sssd-legacy-config.nix { };
15881588
stalwart = runTest ./stalwart/stalwart.nix;
1589+
stardust-xr-atmosphere = runTest ./stardust-xr/atmosphere.nix;
1590+
stardust-xr-flatland = runTest ./stardust-xr/flatland.nix;
15891591
stargazer = runTest ./web-servers/stargazer.nix;
15901592
starship = runTest ./starship.nix;
15911593
startx = import ./startx.nix { inherit pkgs runTest; };

nixos/tests/common/openxr.nix

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
lib,
3+
pkgs,
4+
config,
5+
...
6+
}:
7+
8+
{
9+
imports = [
10+
./user-account.nix
11+
./x11.nix
12+
];
13+
test-support.displayManager.auto.user = "alice";
14+
systemd.user.targets.xdg-desktop-autostart = {
15+
wantedBy = [ "graphical-session.target" ];
16+
after = [ "graphical-session.target" ];
17+
};
18+
19+
hardware.graphics.enable = true;
20+
21+
services.monado = {
22+
enable = true;
23+
defaultRuntime = true;
24+
forceDefaultRuntime = true;
25+
};
26+
systemd.user.services.monado = {
27+
requires = [ "graphical-session.target" ];
28+
environment = {
29+
# Stop Monado from probing for any hardware
30+
SIMULATED_ENABLE = "1";
31+
SIMULATED_LEFT = "simple";
32+
SIMULATED_RIGHT = "simple";
33+
# Run as X11 client rather than using direct mode
34+
XRT_COMPOSITOR_FORCE_XCB = "1";
35+
# And run fullscreen so that we can hide the DE
36+
XRT_COMPOSITOR_XCB_FULLSCREEN = "1";
37+
};
38+
};
39+
}

nixos/tests/monado.nix

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,57 @@
33
name = "monado";
44

55
nodes.machine =
6-
{ pkgs, ... }:
6+
{
7+
lib,
8+
pkgs,
9+
config,
10+
...
11+
}:
712

813
{
9-
hardware.graphics.enable = true;
10-
users.users.alice = {
11-
isNormalUser = true;
12-
uid = 1000;
14+
imports = [ ./common/openxr.nix ];
15+
16+
systemd.user.services.print-openxr-info = {
17+
wantedBy = [ "xdg-desktop-autostart.target" ];
18+
requires = [ "monado.service" ];
19+
script = lib.getExe' pkgs.openxr-loader "openxr_runtime_list";
20+
serviceConfig = {
21+
Type = "oneshot";
22+
RemainAfterExit = true;
23+
};
1324
};
1425

15-
services.monado = {
16-
enable = true;
17-
defaultRuntime = true;
18-
19-
forceDefaultRuntime = true;
26+
systemd.user.services.xrgears = {
27+
wantedBy = [ "xdg-desktop-autostart.target" ];
28+
requires = [ "monado.service" ];
29+
script = lib.getExe pkgs.xrgears;
2030
};
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 ];
2531
};
2632

2733
testScript =
2834
{ nodes, ... }:
29-
let
30-
userId = toString nodes.machine.users.users.alice.uid;
31-
runtimePath = "/run/user/${userId}";
32-
in
3335
''
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")
36+
with subtest("Ensure X11 starts"):
37+
start_all()
38+
machine.succeed("loginctl enable-linger alice")
39+
machine.wait_for_x()
40+
41+
with subtest("Ensure default runtime present"):
42+
machine.succeed("stat /etc/xdg/openxr/1/active_runtime.json")
43+
44+
with subtest("Ensure forced runtime present"):
45+
# Monado needs to be started to create the forced runtime file
46+
machine.systemctl("start monado.service", "alice")
47+
machine.wait_for_unit("monado.service", "alice")
48+
machine.succeed("stat /home/alice/.config/openxr/1/active_runtime.json")
49+
50+
with subtest("Ensure openxr_runtime_list can find runtime"):
51+
machine.wait_for_unit("print-openxr-info.service", "alice")
52+
53+
with subtest("Ensure xrgears launches"):
54+
machine.wait_for_unit("xrgears.service", "alice")
55+
# TODO: 10 seconds should be long enough for anything, but this is theoretically flaky
56+
machine.sleep(10)
57+
machine.screenshot("screen")
4858
'';
4959
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{ ... }:
2+
{
3+
name = "stardust-xr-atmosphere";
4+
5+
# Doesn't understand @polling_condition
6+
skipTypeCheck = true;
7+
8+
nodes.machine =
9+
{
10+
lib,
11+
pkgs,
12+
config,
13+
...
14+
}:
15+
16+
{
17+
imports = [ ./common.nix ];
18+
19+
virtualisation.memorySize = 4096;
20+
21+
systemd.user.services.stardust-xr-atmosphere = {
22+
wantedBy = [ "xdg-desktop-autostart.target" ];
23+
requires = [ "stardust-xr-server.service" ];
24+
after = [ "stardust-xr-server.service" ];
25+
script = ''
26+
set -eufx pipefail
27+
${lib.getExe pkgs.stardust-xr-atmosphere} install ${pkgs.stardust-xr-atmosphere}/share/atmosphere/default_envs/the_grid
28+
${lib.getExe pkgs.stardust-xr-atmosphere} set-default the_grid
29+
${lib.getExe pkgs.stardust-xr-atmosphere} show
30+
'';
31+
environment.RUST_BACKTRACE = "full";
32+
};
33+
};
34+
35+
testScript =
36+
{ nodes, ... }:
37+
''
38+
@polling_condition()
39+
def atmosphere_running():
40+
machine.wait_for_unit("stardust-xr-atmosphere.service", "alice")
41+
42+
with subtest("Ensure X11 starts"):
43+
start_all()
44+
machine.succeed("loginctl enable-linger alice")
45+
machine.wait_for_x()
46+
47+
with subtest("Ensure system works"):
48+
with atmosphere_running:
49+
# TODO(@Pandapip1): 20 seconds should be long enough for anything, but this is theoretically flaky
50+
# Adding systemd notify support to stardust-xr-atmosphere should resolve this
51+
machine.sleep(20)
52+
machine.screenshot("screen")
53+
'';
54+
}

nixos/tests/stardust-xr/common.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
lib,
3+
pkgs,
4+
...
5+
}:
6+
7+
{
8+
imports = [ ../common/openxr.nix ];
9+
10+
# TODO(@Pandapip1): For the time being, Stardust doesn't like controllers rather than hand tracking
11+
services.monado.enable = lib.mkForce false;
12+
13+
systemd.user.services.stardust-xr-server = {
14+
wantedBy = [ "xdg-desktop-autostart.target" ];
15+
# requires = [ "monado.service" ];
16+
serviceConfig = {
17+
Type = "notify";
18+
NotifyAccess = "all";
19+
ExecStart = "${lib.getExe pkgs.stardust-xr-server} -e ${pkgs.writeShellScript "notifyReady" "systemd-notify --ready"}";
20+
};
21+
environment.RUST_BACKTRACE = "full";
22+
};
23+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{ ... }:
2+
{
3+
name = "stardust-xr-flatland";
4+
5+
# Doesn't understand @polling_condition
6+
skipTypeCheck = true;
7+
8+
nodes.machine =
9+
{
10+
lib,
11+
pkgs,
12+
config,
13+
...
14+
}:
15+
16+
{
17+
imports = [ ./common.nix ];
18+
19+
systemd.user.services.stardust-xr-flatland = {
20+
wantedBy = [ "xdg-desktop-autostart.target" ];
21+
requires = [ "stardust-xr-server.service" ];
22+
after = [ "stardust-xr-server.service" ];
23+
script = lib.getExe pkgs.stardust-xr-flatland;
24+
environment.RUST_BACKTRACE = "full";
25+
};
26+
27+
systemd.user.services.test-wayland-app = {
28+
wantedBy = [ "xdg-desktop-autostart.target" ];
29+
requires = [ "stardust-xr-flatland.service" ];
30+
after = [ "stardust-xr-flatland.service" ];
31+
script = lib.getExe pkgs.wayland-colorbar;
32+
environment = {
33+
DISPLAY = "";
34+
WAYLAND_DISPLAY = "wayland-0";
35+
};
36+
};
37+
};
38+
39+
testScript =
40+
{ nodes, ... }:
41+
''
42+
@polling_condition()
43+
def wayland_client_running():
44+
machine.wait_for_unit("test-wayland-app.service", "alice")
45+
46+
with subtest("Ensure X11 starts"):
47+
start_all()
48+
machine.succeed("loginctl enable-linger alice")
49+
machine.wait_for_x()
50+
51+
with subtest("Ensure system works"):
52+
with wayland_client_running:
53+
# TODO: 20 seconds should be long enough for anything, but this is theoretically flaky
54+
machine.sleep(20)
55+
machine.screenshot("screen")
56+
'';
57+
}

pkgs/by-name/st/stardust-xr-atmosphere/package.nix

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,42 @@
77
nix-update-script,
88
}:
99

10-
rustPlatform.buildRustPackage {
10+
rustPlatform.buildRustPackage (finalAttrs: {
1111
pname = "stardust-xr-atmosphere";
12-
version = "0-unstable-2024-08-22";
12+
version = "0.51.1";
1313

1414
src = fetchFromGitHub {
1515
owner = "stardustxr";
1616
repo = "atmosphere";
17-
rev = "0c8bfb91e8ca32a4895f858067334ed265517309";
18-
hash = "sha256-pk1+kkPV6fx+7Xz9hKFFVw402iztcvNC31zVCc3hfTY=";
17+
tag = finalAttrs.version;
18+
hash = "sha256-FH9Y+p17bGczRhLEfxVqc1peg9Aubw1pu7QOYb6RWvc=";
1919
};
2020

21-
cargoHash = "sha256-eQjRbavmUW2iw0OEC/DPk2FflTc4QCn0K/c4Og+sGW4=";
21+
cargoHash = "sha256-TVAm6BdIAE+gxWkpEUqF3R99UKhIGGSZK9qQ7urR7Uc=";
22+
23+
postInstall = ''
24+
mkdir -p $out/share/atmosphere
25+
cp -r default_envs $out/share/atmosphere
26+
'';
27+
28+
__structuredAttrs = true;
29+
strictDeps = true;
2230

2331
passthru = {
2432
tests.versionTest = testers.testVersion {
2533
package = stardust-xr-atmosphere;
2634
command = "atmosphere --version";
2735
version = "stardust-xr-atmosphere 0.4.0";
2836
};
29-
updateScript = nix-update-script {
30-
extraArgs = [ "--version=branch" ];
31-
};
37+
updateScript = nix-update-script { };
3238
};
3339

3440
meta = {
3541
description = "Environment, homespace, and setup client for Stardust XR";
3642
homepage = "https://stardustxr.org";
3743
license = lib.licenses.mit;
3844
mainProgram = "atmosphere";
39-
maintainers = with lib.maintainers; [
40-
pandapip1
41-
technobaboo
42-
];
43-
platforms = lib.platforms.linux;
45+
teams = with lib.teams; [ stardust-xr ];
46+
platforms = lib.platforms.unix;
4447
};
45-
}
48+
})
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/src/resize_handles.rs b/src/resize_handles.rs
2+
index 0fcb071..69d2f2f 100644
3+
--- a/src/resize_handles.rs
4+
+++ b/src/resize_handles.rs
5+
@@ -451,7 +451,7 @@ impl<State: ValidState> CustomElement<State> for ResizeHandles<State> {
6+
#[tokio::test]
7+
async fn test_resize_handles() {
8+
use serde::{Deserialize, Serialize};
9+
- use stardust_xr_asteroids::{client, ClientState, Migrate, Reify, Transformable};
10+
+ use stardust_xr_asteroids::{client, ClientState, Migrate, Reify, Tasker, Transformable};
11+
12+
// Simple test state
13+
#[derive(Debug, Serialize, Deserialize)]
14+
@@ -474,7 +474,11 @@ async fn test_resize_handles() {
15+
const APP_ID: &'static str = "org.stardustxr.flatland.ResizeHandles";
16+
}
17+
impl Reify for State {
18+
- fn reify(&self) -> impl stardust_xr_asteroids::Element<Self> {
19+
+ fn reify(
20+
+ &self,
21+
+ _context: &Context,
22+
+ _tasks: impl Tasker<Self>,
23+
+ ) -> impl stardust_xr_asteroids::Element<Self> {
24+
stardust_xr_asteroids::elements::Spatial::default()
25+
.rot(Quat::from_rotation_y(self.time / 10.0))
26+
.build()

0 commit comments

Comments
 (0)