petersweb-infra/nixos/vnc-desktop/start.sh
Philip Peterson 25b13b47e5 vnc: KDE Plasma desktop, local image build via systemd
Replace openbox with kde-plasma-desktop + konsole. Build the container
image locally via a oneshot systemd service (build-vnc-image) that runs
before arion-vnc-desktop on each boot. Nix hashes the Dockerfile and
start.sh at eval time so the build is skipped when nothing changed.
No registry push/pull required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 19:14:53 -08:00

28 lines
639 B
Bash

#!/bin/bash
set -e
mkdir -p /root/.vnc /root/.ssh
chmod 700 /root/.ssh
# Set VNC password from environment
echo "${VNC_PASSWORD:?VNC_PASSWORD must be set}" | vncpasswd -f > /root/.vnc/passwd
chmod 600 /root/.vnc/passwd
# Start Xvnc (headless X server + VNC server in one)
Xvnc :1 \
-rfbport 5901 \
-SecurityTypes VncAuth \
-PasswordFile /root/.vnc/passwd \
-geometry 1280x800 \
-depth 24 \
-AlwaysShared \
&
export DISPLAY=:1
sleep 2
# Start KDE Plasma session
dbus-run-session -- startplasma-x11 &
# Serve noVNC web UI + bridge WebSocket -> VNC
exec websockify --web /usr/share/novnc 6080 localhost:5901