fix(#540): use systemd.globalEnvironment instead of environment.variables

environment.variables writes to /etc/environment (PAM sessions only)
and is not visible to systemd service units. The correct path for
env vars that need to reach all systemd services is
systemd.globalEnvironment (sets DefaultEnvironment in systemd.conf),
which is the pattern established by #608 for HYPERHIVE_STATE_DIR.

Also update the inline comment reference from environment.variables
to systemd.globalEnvironment.
This commit is contained in:
iris 2026-05-31 22:58:46 +02:00 committed by mara
commit cce85a6c1b

View file

@ -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";
};