rename: lumen → punktfunk, everywhere
ci / rust (push) Has been cancelled

Full project rename, decided 2026-06-10:
- Crates/binaries: punktfunk-core / punktfunk-host / punktfunk-client-rs.
- C ABI: punktfunk_* symbols, Punktfunk* types, include/punktfunk_core.h,
  PUNKTFUNK_FEATURE_QUIC guard (header regenerated; cbindgen renames updated, incl.
  PUNKTFUNK_BTN_*/PUNKTFUNK_AXIS_* wire constants).
- Protocol: punktfunk/1 — control-plane magic LMN1 → PKF1, nonce salt lmn1 → pkf1.
  WIRE BREAK: clients must be rebuilt from this revision.
- Env knobs: PUNKTFUNK_VIDEO_SOURCE / PUNKTFUNK_COMPOSITOR / PUNKTFUNK_ZEROCOPY / ….
- Host config dir: ~/.config/punktfunk (the box's dir was migrated in place — the
  persistent identity is unchanged, pinned fingerprints stay valid).
- Swift package: PunktfunkKit + PunktfunkCore.xcframework + PunktfunkConnection
  (Sources/PunktfunkClient app + tests renamed with it); build-xcframework.sh updated.
- scripts/: 60-punktfunk.rules, punktfunk-host.service; OpenAPI doc regenerated.

Also: scripts/headless/run-headless-kde.sh — full headless Plasma bringup. Root cause of
"desktop but no apps/settings" over the stream: plasmashell launched without
XDG_MENU_PREFIX=plasma-, so the launcher resolved a nonexistent applications.menu and
rendered an empty menu. The script sets the complete KDE session env (menu prefix,
KDE_FULL_SESSION, session version) and rebuilds ksycoca before starting plasmashell.

Gate: 97/97 tests, clippy -D warnings (both feature sets), fmt, C-ABI harness PASS,
zero lumen references left outside .git.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-10 13:11:59 +00:00
parent b8b23c8fb2
commit bfd64ce871
119 changed files with 1245 additions and 1185 deletions
@@ -1,11 +1,11 @@
# udev rules for the lumen streaming host (mirrors Sunshine's 60-sunshine.rules).
# udev rules for the punktfunk streaming host (mirrors Sunshine's 60-sunshine.rules).
#
# Grants the `input` group access to /dev/uinput so the host can create virtual gamepads
# (one X-Box-360-class pad per connected Moonlight controller). `static_node` makes the node
# exist before the uinput module loads.
#
# Install:
# sudo cp scripts/60-lumen.rules /etc/udev/rules.d/
# sudo cp scripts/60-punktfunk.rules /etc/udev/rules.d/
# sudo usermod -aG input $USER # then re-login (or reboot)
# sudo udevadm control --reload-rules && sudo udevadm trigger
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", GROUP="input", MODE="0660", TAG+="uaccess"
+3 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Bootstrap an Ubuntu (24.04 "noble") NVIDIA-GPU VM to build/run the lumen Linux host
# Bootstrap an Ubuntu (24.04 "noble") NVIDIA-GPU VM to build/run the punktfunk Linux host
# and the M0 capture spike (headless Sway/wlroots -> PipeWire -> NVENC).
#
# Assumes the NVIDIA driver + an FFmpeg-with-NVENC are ALREADY installed (verify-only).
@@ -57,10 +57,10 @@ if have ffmpeg; then
ok "FFmpeg has NVENC: $(ffmpeg -hide_banner -encoders 2>/dev/null | grep -oE '(hevc|h264)_nvenc' | paste -sd' ' -)"
log " smoke-test: 1s HEVC NVENC encode to null"
if ffmpeg -hide_banner -loglevel error -f lavfi -i color=c=black:s=1280x720:d=1 \
-c:v hevc_nvenc -preset p1 -tune ull -f null - 2>/tmp/lumen_nvenc.err; then
-c:v hevc_nvenc -preset p1 -tune ull -f null - 2>/tmp/punktfunk_nvenc.err; then
ok "hevc_nvenc encode succeeded — NVENC is usable in this guest"
else
warn "hevc_nvenc encode FAILED (see /tmp/lumen_nvenc.err). Common cause on a VM: \
warn "hevc_nvenc encode FAILED (see /tmp/punktfunk_nvenc.err). Common cause on a VM: \
missing libnvidia-encode.so.1 or an unlicensed vGPU."
fi
else
+21 -21
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# Build LumenCore.xcframework for the Apple clients — run ON A MAC with Xcode + rustup.
# Build PunktfunkCore.xcframework for the Apple clients — run ON A MAC with Xcode + rustup.
#
# rustup target add aarch64-apple-darwin x86_64-apple-darwin # + aarch64-apple-ios for iOS
# bash scripts/build-xcframework.sh
#
# Output: clients/apple/LumenCore.xcframework (consumed by clients/apple/Package.swift).
# The library is built WITH the `quic` feature (the lumen/1 connection API), so the bundled
# header gets LUMEN_FEATURE_QUIC pre-defined — Swift sees lumen_connect & co. unconditionally.
# Output: clients/apple/PunktfunkCore.xcframework (consumed by clients/apple/Package.swift).
# The library is built WITH the `quic` feature (the punktfunk/1 connection API), so the bundled
# header gets PUNKTFUNK_FEATURE_QUIC pre-defined — Swift sees punktfunk_connect & co. unconditionally.
set -euo pipefail
cd "$(dirname "$0")/.."
@@ -16,10 +16,10 @@ BUILD_IOS="${BUILD_IOS:-0}" # BUILD_IOS=1 adds an iOS slice (requires the ios ta
# Deployment targets must match Package.swift's platforms, or every consumer link emits
# "object file was built for newer macOS version" warnings.
for t in "${TARGETS_MAC[@]}"; do
MACOSX_DEPLOYMENT_TARGET=14.0 cargo build --release -p lumen-core --features quic --target "$t"
MACOSX_DEPLOYMENT_TARGET=14.0 cargo build --release -p punktfunk-core --features quic --target "$t"
done
if [[ "$BUILD_IOS" == "1" ]]; then
IPHONEOS_DEPLOYMENT_TARGET=17.0 cargo build --release -p lumen-core --features quic --target aarch64-apple-ios
IPHONEOS_DEPLOYMENT_TARGET=17.0 cargo build --release -p punktfunk-core --features quic --target aarch64-apple-ios
fi
STAGE="$(mktemp -d)"
@@ -28,33 +28,33 @@ trap 'rm -rf "$STAGE"' EXIT
# Universal macOS static lib.
mkdir -p "$STAGE/macos"
lipo -create \
target/aarch64-apple-darwin/release/liblumen_core.a \
target/x86_64-apple-darwin/release/liblumen_core.a \
-output "$STAGE/macos/liblumen_core.a"
target/aarch64-apple-darwin/release/libpunktfunk_core.a \
target/x86_64-apple-darwin/release/libpunktfunk_core.a \
-output "$STAGE/macos/libpunktfunk_core.a"
# Headers dir: the generated C header (with the quic API force-enabled) + a modulemap so
# Swift can `import LumenCore`.
# Swift can `import PunktfunkCore`.
mkdir -p "$STAGE/include"
{
echo "#define LUMEN_FEATURE_QUIC 1"
cat include/lumen_core.h
} > "$STAGE/include/lumen_core.h"
echo "#define PUNKTFUNK_FEATURE_QUIC 1"
cat include/punktfunk_core.h
} > "$STAGE/include/punktfunk_core.h"
cat > "$STAGE/include/module.modulemap" <<'EOF'
module LumenCore {
header "lumen_core.h"
module PunktfunkCore {
header "punktfunk_core.h"
export *
}
EOF
ARGS=(-library "$STAGE/macos/liblumen_core.a" -headers "$STAGE/include")
ARGS=(-library "$STAGE/macos/libpunktfunk_core.a" -headers "$STAGE/include")
if [[ "$BUILD_IOS" == "1" ]]; then
ARGS+=(-library target/aarch64-apple-ios/release/liblumen_core.a -headers "$STAGE/include")
ARGS+=(-library target/aarch64-apple-ios/release/libpunktfunk_core.a -headers "$STAGE/include")
fi
# Cargo does NOT fingerprint MACOSX_DEPLOYMENT_TARGET — units cached from a build without
# it keep their old minos forever. Refuse to ship anything newer than the package floor
# (objects BELOW it, e.g. rustup's precompiled std at 11.0, are fine and unavoidable).
for obj in "$STAGE"/macos/liblumen_core.a; do
for obj in "$STAGE"/macos/libpunktfunk_core.a; do
bad=$(otool -l "$obj" 2>/dev/null | awk '/minos/ {print $2}' | sort -uV | awk -F. '$1 > 14' | head -1)
if [[ -n "$bad" ]]; then
echo "ERROR: $obj contains objects built for macOS $bad (> 14.0)." >&2
@@ -63,6 +63,6 @@ for obj in "$STAGE"/macos/liblumen_core.a; do
fi
done
rm -rf clients/apple/LumenCore.xcframework
xcodebuild -create-xcframework "${ARGS[@]}" -output clients/apple/LumenCore.xcframework
echo "OK: clients/apple/LumenCore.xcframework"
rm -rf clients/apple/PunktfunkCore.xcframework
xcodebuild -create-xcframework "${ARGS[@]}" -output clients/apple/PunktfunkCore.xcframework
echo "OK: clients/apple/PunktfunkCore.xcframework"
+1 -1
View File
@@ -7,7 +7,7 @@
# Ctrl-C to stop; then play/inspect the file (e.g. ffprobe out.mkv).
set -euo pipefail
OUT="${1:-/tmp/lumen-headless-test.mkv}"
OUT="${1:-/tmp/punktfunk-headless-test.mkv}"
: "${WAYLAND_DISPLAY:?set WAYLAND_DISPLAY (e.g. wayland-1) — is headless Sway running?}"
: "${XDG_RUNTIME_DIR:?set XDG_RUNTIME_DIR=/run/user/\$(id -u)}"
+1 -1
View File
@@ -1,5 +1,5 @@
# shellcheck shell=bash
# Source before launching headless Sway / the lumen host on an NVIDIA VM:
# Source before launching headless Sway / the punktfunk host on an NVIDIA VM:
# source scripts/headless/env.sh
# These are the wlroots-on-NVIDIA workarounds the research turned up (gles2 is the
# known-good renderer; Vulkan is flaky on the proprietary driver — try it only later).
+6 -6
View File
@@ -2,8 +2,8 @@
# Run AFTER headless Sway is up (run-headless-sway.sh), from a second shell on the same
# user. It: (1) points this shell at the running Sway, (2) gives HEADLESS-1 a real refresh
# clock (an idle/0 mHz output produces no frames), (3) imports the env the ScreenCast portal
# needs to find Sway and pick the wlr backend, and (4) writes /tmp/lumen-sway-env.sh so
# other shells (e.g. `cargo run -p lumen-host`) can `source` it.
# needs to find Sway and pick the wlr backend, and (4) writes /tmp/punktfunk-sway-env.sh so
# other shells (e.g. `cargo run -p punktfunk-host`) can `source` it.
#
# Usage: bash scripts/headless/prepare-session.sh [WxH@RHz] (default 1920x1080@60Hz)
set -euo pipefail
@@ -32,7 +32,7 @@ echo "HEADLESS-1 set to $MODE"
systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK XDG_RUNTIME_DIR 2>/dev/null || true
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK 2>/dev/null || true
cat > /tmp/lumen-sway-env.sh <<EOF
cat > /tmp/punktfunk-sway-env.sh <<EOF
export XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR
export WAYLAND_DISPLAY=$WAYLAND_DISPLAY
export XDG_CURRENT_DESKTOP=sway
@@ -42,8 +42,8 @@ EOF
cat <<EOF
session ready. From any shell on this user:
source /tmp/lumen-sway-env.sh
source /tmp/punktfunk-sway-env.sh
swaymsg exec foot # optional: animated on-screen content
cargo run -p lumen-host -- m0 --source portal --seconds 5 --out /tmp/lumen-m0.h265
ffprobe /tmp/lumen-m0.h265
cargo run -p punktfunk-host -- m0 --source portal --seconds 5 --out /tmp/punktfunk-m0.h265
ffprobe /tmp/punktfunk-m0.h265
EOF
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Headless KDE Plasma session for the punktfunk host (no KMS scanout → kwin --virtual).
#
# Brings up the full desktop, not just the compositor. The env matters: without
# XDG_MENU_PREFIX=plasma- the launcher resolves ${XDG_MENU_PREFIX}applications.menu →
# "applications.menu", which doesn't exist on KDE installs (it ships
# plasma-applications.menu) — plasmashell runs fine but the menu shows NO applications
# and no System Settings entry. kded6/krunner/kglobalacceld are D-Bus-activated once
# plasmashell starts in the right session env.
#
# bash scripts/headless/run-headless-kde.sh [WxH] # default 1920x1080
#
# Then in another shell:
# WAYLAND_DISPLAY=wayland-kde XDG_CURRENT_DESKTOP=KDE PUNKTFUNK_ZEROCOPY=1 \
# punktfunk-host m3-host --source virtual --seconds 14400
set -euo pipefail
RES="${1:-1920x1080}"
W="${RES%x*}"
H="${RES#*x}"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
export DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS:-unix:path=$XDG_RUNTIME_DIR/bus}"
export XDG_CURRENT_DESKTOP=KDE
export XDG_MENU_PREFIX=plasma-
export KDE_FULL_SESSION=true
export KDE_SESSION_VERSION=6
export DESKTOP_SESSION=plasma
export WAYLAND_DISPLAY=wayland-kde
export KWIN_WAYLAND_NO_PERMISSION_CHECKS=1
kwin_wayland --virtual --width "$W" --height "$H" --no-lockscreen \
--socket "$WAYLAND_DISPLAY" &
KWIN_PID=$!
sleep 2
kbuildsycoca6 >/dev/null 2>&1 || true # rebuild the menu cache under the correct env
plasmashell &
echo "headless KDE up on $WAYLAND_DISPLAY ($RES), kwin pid $KWIN_PID"
wait "$KWIN_PID"
+2 -2
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# Launch headless Sway on the NVIDIA box for the lumen M0 capture spike.
# Launch headless Sway on the NVIDIA box for the punktfunk M0 capture spike.
#
# Runs on the user's *shared* session bus (NOT a private dbus-run-session) so that the
# ScreenCast portal (xdg-desktop-portal-wlr) and the lumen host share one bus. After this
# ScreenCast portal (xdg-desktop-portal-wlr) and the punktfunk host share one bus. After this
# is up, run `prepare-session.sh` from a second shell to set the mode + portal env.
#
# Prereqs (see docs/linux-setup.md / scripts/bootstrap-ubuntu.sh):
+1 -1
View File
@@ -1,4 +1,4 @@
# Minimal headless Sway config for the lumen M0 capture spike.
# Minimal headless Sway config for the punktfunk M0 capture spike.
# Under WLR_BACKENDS=headless, Sway 1.9 auto-creates one output named HEADLESS-1
# (fixed 1920x1080); this just resizes it. For extra outputs: `swaymsg create_output`
# (auto-named HEADLESS-2, ...). Set the resolution to your target client size.
+8 -8
View File
@@ -1,4 +1,4 @@
# lumen host configuration (~/.config/lumen/host.env) — consumed by lumen-host.service.
# punktfunk host configuration (~/.config/punktfunk/host.env) — consumed by punktfunk-host.service.
# Session / compositor environment (headless KWin example).
XDG_RUNTIME_DIR=/run/user/1000
@@ -8,15 +8,15 @@ XDG_CURRENT_DESKTOP=KDE
# Video source: `virtual` creates a per-client virtual output at the client's exact
# resolution+refresh (the flagship mode); `portal` captures an existing monitor.
LUMEN_VIDEO_SOURCE=virtual
PUNKTFUNK_VIDEO_SOURCE=virtual
# GPU zero-copy capture (EGL/Vulkan → CUDA → NVENC). Falls back to CPU automatically.
LUMEN_ZEROCOPY=1
PUNKTFUNK_ZEROCOPY=1
# Optional overrides (apps.json is the primary mechanism for per-app settings):
#LUMEN_COMPOSITOR=kwin # kwin | mutter | gamescope | wlroots
#LUMEN_GAMESCOPE_APP=vkcube # nested command for ad-hoc gamescope sessions
#LUMEN_INPUT_BACKEND=libei # wlr | libei | gamescope | uinput
#LUMEN_FEC_PCT=20 # video FEC overhead percent
#LUMEN_PERF=1 # per-stage timing logs
#PUNKTFUNK_COMPOSITOR=kwin # kwin | mutter | gamescope | wlroots
#PUNKTFUNK_GAMESCOPE_APP=vkcube # nested command for ad-hoc gamescope sessions
#PUNKTFUNK_INPUT_BACKEND=libei # wlr | libei | gamescope | uinput
#PUNKTFUNK_FEC_PCT=20 # video FEC overhead percent
#PUNKTFUNK_PERF=1 # per-stage timing logs
#RUST_LOG=info
-21
View File
@@ -1,21 +0,0 @@
# lumen streaming host — systemd USER unit.
#
# Install:
# mkdir -p ~/.config/systemd/user && cp scripts/lumen-host.service ~/.config/systemd/user/
# cp scripts/host.env.example ~/.config/lumen/host.env # then edit
# systemctl --user daemon-reload && systemctl --user enable --now lumen-host
#
# The unit assumes the compositor session (e.g. headless KWin on wayland-kde) is already up;
# for a fully self-contained appliance, pair it with a kwin_wayland user unit it can After=.
[Unit]
Description=lumen GameStream host
After=pipewire.service
[Service]
EnvironmentFile=%h/.config/lumen/host.env
ExecStart=%h/lumen/target/release/lumen-host serve
Restart=on-failure
RestartSec=2
[Install]
WantedBy=default.target
+21
View File
@@ -0,0 +1,21 @@
# punktfunk streaming host — systemd USER unit.
#
# Install:
# mkdir -p ~/.config/systemd/user && cp scripts/punktfunk-host.service ~/.config/systemd/user/
# cp scripts/host.env.example ~/.config/punktfunk/host.env # then edit
# systemctl --user daemon-reload && systemctl --user enable --now punktfunk-host
#
# The unit assumes the compositor session (e.g. headless KWin on wayland-kde) is already up;
# for a fully self-contained appliance, pair it with a kwin_wayland user unit it can After=.
[Unit]
Description=punktfunk GameStream host
After=pipewire.service
[Service]
EnvironmentFile=%h/.config/punktfunk/host.env
ExecStart=%h/punktfunk/target/release/punktfunk-host serve
Restart=on-failure
RestartSec=2
[Install]
WantedBy=default.target