[Unit]
Description=Nucleic Linux guest agent (vsock control plane)
Documentation=https://github.com/abkslm/nucleic/blob/main/docs/LINUX_VM.md
# The agent binds AF_VSOCK, which needs the vsock transport up; network is not required (vsock is not
# IP), but ordering after basic.target keeps it out of very early boot.
After=basic.target
Wants=basic.target
# Never give up. The default rate limit (5 starts / 10s) turned one transient fault into a dead
# control plane: when the vsock module wasn't loaded yet the agent crashed 5x in ~6s, systemd hit
# 'start-limit-hit', and the guest stayed unreachable forever even after the module appeared. With
# the limit off, Restart+RestartSec below retry indefinitely until vsock is up.
StartLimitIntervalSec=0

[Service]
Type=simple
ExecStart=/usr/local/bin/nucleic-linux-agent
# Like the macOS LaunchAgent's KeepAlive: a crashed agent is restarted so a host reconnect always finds
# a listener without needing the whole guest to reboot.
Restart=always
RestartSec=1
# The agent execs commands the host sends; it runs as root in a disposable, NAT-isolated guest.
User=root
# Standard streams go to the journal (systemd stamps them); the agent logs to stderr.
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
