diff --git a/nix/templates/weston-vnc.nix b/nix/templates/weston-vnc.nix index 1102ef1d..227e6248 100644 --- a/nix/templates/weston-vnc.nix +++ b/nix/templates/weston-vnc.nix @@ -95,7 +95,7 @@ # --socket=wayland-0: pin the compositor's Wayland socket name # to `wayland-0` (weston default is to pick any free name such # as `wayland-1`). Pinning lets the WAYLAND_DISPLAY=wayland-0 - # global env injection below (see environment.variables) take + # global env injection below (see systemd.globalEnvironment) take # effect unconditionally — any Wayland client launched by any # systemd service in this container automatically connects to # this compositor instead of failing or starting a second @@ -114,15 +114,18 @@ }; }; - # Expose the compositor's socket to every process in the container - # so Wayland clients started by any systemd service (e.g. bitburner - # launched via a `systemd.services.*` declaration in agent.nix) can - # find the compositor without per-service wiring. Without these vars - # a service starting a Wayland client would either fail to connect - # (libwayland falls back to creating a headless display) or open a - # second compositor entirely — both cause the VNC session to show a - # blank desktop while apps appear to "work" elsewhere (#540). - environment.variables = { + # Expose the compositor's socket to every systemd service in the + # container so Wayland clients (e.g. bitburner started via + # `systemd.services.*` in agent.nix) can find the compositor + # without per-service wiring. `systemd.globalEnvironment` is the + # correct path (established by #608 for HYPERHIVE_STATE_DIR) — + # it sets DefaultEnvironment in systemd.conf, reaching all units + # started by PID 1. `environment.variables` goes to /etc/environment + # (PAM sessions only) and is NOT visible to systemd service units. + # Without these vars a service starting a Wayland client would either + # fail to connect (libwayland falls back to a headless display) or + # open a second compositor — VNC shows a blank desktop (#540). + systemd.globalEnvironment = { WAYLAND_DISPLAY = "wayland-0"; XDG_RUNTIME_DIR = "/run/user/0"; };