summaryrefslogtreecommitdiffstats
path: root/nixos/tests/stardust-xr/atmosphere.nix
blob: 7eb2f7b2778ecd8dcc3df62b7716c436c38eb8f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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")
    '';
}