[Unit] Description=mediapi player (X kiosk: one mpv mirrored across all HDMI outputs) # Wait until udev has settled so the DRM/HDMI devices (/dev/dri/*) exist before # X tries to grab them. Without this a cold-boot race can leave X unable to find # a screen. (systemd-udev-settle is deprecated but still the simplest reliable # gate here; the session script additionally waits for connectors to appear.) After=local-fs.target systemd-udev-settle.service Wants=systemd-udev-settle.service [Service] Type=simple User=${MEDIAPI_USER} # video+render: GPU/DRM access. input: evdev under X. tty: own the VT for X. SupplementaryGroups=video render input tty # A controlling tty so the X server can take over VT 7. TTYPath=/dev/tty7 StandardInput=tty StandardOutput=journal StandardError=journal RuntimeDirectory=mediapi RuntimeDirectoryMode=0770 # xinit starts the X server on VT 7 and runs the session script as its client. # The session mirrors the HDMI outputs (single DRM master) and execs one mpv. # Non-root X is permitted via /etc/X11/Xwrapper.config (installed by install.sh). ExecStart=/usr/bin/xinit ${PROJECT_DIR}/scripts/mediapi-session.sh -- :0 vt7 -nolisten tcp -keeptty Restart=on-failure RestartSec=2 [Install] WantedBy=multi-user.target