WEFT_OS/infra/systemd/weft-appd.service
Marco Allegretti a1edac63b8
fix(session): start the session as user units through its own target
The tty1 login hook ran systemctl --user start graphical-session.target,
which systemd refuses (RefuseManualStart=yes), so none of the NixOS
session's services started. The units in infra/systemd were wanted by
graphical.target, a system target, although weft-appd's needs the
session user's runtime and home directories and the compositor publishes
its socket to the user manager; run as system units the shell could
never learn the socket.

weft-session.target binds graphical-session.target and wants the
compositor, shell and weft-appd, in the NixOS configuration and as a
user unit in infra/systemd; the login hook starts it. The services are
part of the graphical session, the shell no longer hardcodes the
compositor's socket, and the compositor's units unset WAYLAND_DISPLAY
and DISPLAY so a restarted compositor does not take them for an
enclosing session and pick the nested backend. As a user unit, weft-appd
drops ProtectSystem= and PrivateTmp=, which a user manager implements
with PrivateUsers=yes, under which the setuid mount helper cannot mount
verified images. docs/building.md adds the VM's disabled graphics and
its mount helper, which the Nix store cannot hold setuid, to what still
keeps the image from a working desktop.

Rendered from the NixOS configuration, and as installed from
infra/systemd, the units pass systemd-analyze --user verify.
2026-10-09 20:35:58 +00:00

22 lines
933 B
Desktop File

[Unit]
Description=WEFT Application Daemon
Documentation=https://github.com/weft-os/weft
Requires=weft-compositor.service
After=weft-compositor.service servo-shell.service
PartOf=graphical-session.target
[Service]
Type=notify
Environment=WEFT_RUNTIME_BIN=/packages/system/weft-runtime/active/bin/weft-runtime
Environment=WEFT_APP_SHELL_BIN=/packages/system/weft-app-shell/active/bin/weft-app-shell
Environment=WEFT_FILE_PORTAL_BIN=/packages/system/weft-file-portal/active/bin/weft-file-portal
Environment=WEFT_MOUNT_HELPER=/packages/system/weft-mount-helper/active/bin/weft-mount-helper
ExecStart=/packages/system/weft-appd/active/bin/weft-appd
Restart=on-failure
RestartSec=1s
# No ProtectSystem= or PrivateTmp=: in the user manager they imply
# PrivateUsers=yes, under which the setuid weft-mount-helper cannot mount
# verified images. Each session's runtime runs in its own systemd scope.
[Install]
WantedBy=weft-session.target