[Unit]
Description=Nucleic: prepare external-kernel modules (depmod + load virtio drivers)
Documentation=https://github.com/abkslm/nucleic/blob/main/docs/LINUX_VM.md
# The base boots an EXTERNAL kernel against a rootfs into which the bootstrap baked the matching
# modules — but with no modules.dep/.alias (the deb ships none; depmod normally runs in the
# postinst). Regenerate them and load the virtio drivers the guest needs (vsock = the agent's
# control plane; gpu = the desktop surface) EARLY, before the vsock agent and
# systemd-modules-load, so the agent can bind AF_VSOCK on the very first boot. Runs every boot;
# depmod is idempotent and fast. The heavy lifting (naros identity-tagged `uname -r` handling,
# loud diagnostics) lives in nucleic-modsetup.sh.
DefaultDependencies=no
Before=systemd-modules-load.service sysinit.target nucleic-linux-agent.service
# naros-identity-modules aliases /lib/modules for the identity-tagged `uname -r`. Order after it so
# the alias normally exists before depmod runs (the script also creates it itself, so a rootfs
# without that unit — where After= is a no-op — still works).
After=systemd-remount-fs.service naros-identity-modules.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/sbin/nucleic-modsetup.sh

[Install]
WantedBy=sysinit.target
