agent-setup takes its answers from the credentials agent.password, agent.hostname and agent.ssh-key when they are given, so a test VM boots without typing. The README is shorter, explains the mkosi layout and shows how to boot a test VM with these credentials. Also uploads the manifest in the os workflow and ignores the test VM files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
141 lines
4.8 KiB
Plaintext
141 lines
4.8 KiB
Plaintext
# Agent image
|
|
#
|
|
# A Fedora VM image that runs Claude Code in the background. mkosi.extra/ is
|
|
# copied to /, mkosi.repart/ defines the disk and mkosi.sandbox/ adds the
|
|
# Claude Code package repository. The root filesystem, /etc included, is
|
|
# read-only and replaced whole by updates. All state lives on /var. Claude
|
|
# can't change the OS, so it runs its tools in containers.
|
|
|
|
[Distribution]
|
|
Distribution=fedora
|
|
Release=45
|
|
|
|
[Output]
|
|
Format=disk
|
|
ImageId=agent
|
|
OutputDirectory=mkosi.output
|
|
SplitArtifacts=uki,partitions
|
|
# Lists the packages and versions in the image, to tell which builds a CVE
|
|
# affects. .gitea/workflows/os.yml publishes it with the image.
|
|
ManifestFormat=json
|
|
|
|
[Content]
|
|
Bootable=yes
|
|
Bootloader=systemd-boot
|
|
# - kernel-core no drivers or firmware beyond what VMs need
|
|
# - systemd-container systemd-pull, which systemd-sysupdate downloads by
|
|
# - gnupg2 checks the signature of updates
|
|
# - util-linux, shadow-utils console login, setup, newuidmap for rootless podman
|
|
# - systemd-pam login sessions: Claude's user manager and its
|
|
# D-Bus, which rootless podman needs
|
|
# - openssh-server ssh login for the user (keys only)
|
|
# - zram-generator-defaults compressed swap in RAM
|
|
# - podman, podman-docker containers for Claude's toolchains (also as docker)
|
|
# - claude-code from mkosi.sandbox/etc/yum.repos.d
|
|
# - git-core, openssh-clients Claude Code uses git and pushes over ssh
|
|
# - the rest basic command-line tools Claude uses on the host
|
|
Packages=
|
|
kernel-core
|
|
systemd
|
|
dbus-broker
|
|
systemd-udev
|
|
systemd-networkd
|
|
systemd-resolved
|
|
systemd-container
|
|
gnupg2
|
|
systemd-boot-unsigned
|
|
util-linux
|
|
shadow-utils
|
|
systemd-pam
|
|
openssh-server
|
|
zram-generator-defaults
|
|
podman
|
|
podman-docker
|
|
claude-code
|
|
git-core
|
|
openssh-clients
|
|
curl
|
|
tar
|
|
gzip
|
|
xz
|
|
zstd
|
|
diffutils
|
|
findutils
|
|
procps-ng
|
|
iproute
|
|
WithDocs=no
|
|
Locale=C.UTF-8
|
|
# Name UKIs the way systemd-sysupdate names the ones it installs.
|
|
UnifiedKernelImageFormat=%i_%v
|
|
# - console= show the console on screen and on the serial port
|
|
# - systemd.machine_id= take the machine ID from the VM's firmware;
|
|
# mkosi.extra/etc/machine-id is empty, so no boot
|
|
# counts as the first
|
|
# - systemd.firstboot=no agent-setup asks its own questions
|
|
# - damon_reclaim.* free memory unused for an hour (min_age is in µs),
|
|
# so the host can take it back through virtio-balloon
|
|
# free page reporting. The watermarks make it run
|
|
# however much memory is free.
|
|
KernelCommandLine=
|
|
console=tty0
|
|
console=ttyS0,115200n8
|
|
quiet
|
|
systemd.machine_id=firmware
|
|
systemd.firstboot=no
|
|
damon_reclaim.enabled=Y
|
|
damon_reclaim.min_age=3600000000
|
|
damon_reclaim.wmarks_high=1000
|
|
damon_reclaim.wmarks_mid=999
|
|
damon_reclaim.wmarks_low=0
|
|
# The initrd only needs to find and mount the disks of a VM.
|
|
KernelInitrdModules=
|
|
virtio_blk
|
|
virtio_scsi
|
|
sd_mod
|
|
nvme
|
|
dm-verity
|
|
erofs
|
|
ext4
|
|
# All modules but the hardware drivers, then the drivers a VM needs (disks,
|
|
# network, screen) and those of rootless podman's networks (pasta). The last
|
|
# matching line wins. Keyboard, USB and a basic screen are built into the
|
|
# kernel.
|
|
KernelModules=
|
|
/*
|
|
-/drivers/*
|
|
/drivers/virtio/*
|
|
/drivers/block/*
|
|
/drivers/md/*
|
|
nvme
|
|
virtio_scsi
|
|
sd_mod
|
|
virtio_net
|
|
qemu_fw_cfg
|
|
bochs
|
|
virtio-gpu
|
|
veth
|
|
tun
|
|
# - System.map only for debugging the kernel
|
|
# - udev hwdb hardware names and quirks, nothing a VM needs
|
|
# - homed, userdbd, unused services
|
|
# nsresourced
|
|
# - sshd-keygen sshd uses one host key, kept on /var
|
|
# (mkosi.extra/etc/ssh/sshd_config.d)
|
|
RemoveFiles=
|
|
/usr/lib/modules/*/System.map
|
|
/usr/lib/udev/hwdb.bin
|
|
/usr/lib/udev/hwdb.d
|
|
/usr/lib/systemd/system/systemd-homed*
|
|
/usr/lib/systemd/system/systemd-userdbd.*
|
|
/usr/lib/systemd/system/systemd-nsresourced.*
|
|
/usr/lib/systemd/system/sshd-keygen*
|
|
|
|
[Validation]
|
|
# Sign systemd-boot and the UKI for Secure Boot, and put our keys on the ESP.
|
|
# systemd-boot enrolls them at first boot if the firmware is in setup mode (no
|
|
# keys enrolled; in Proxmox, an EFI disk without pre-enrolled keys).
|
|
# mkosi.key is the SECUREBOOT_KEY secret, which .gitea/workflows/os.yml writes.
|
|
SecureBoot=yes
|
|
SecureBootKey=mkosi.key
|
|
SecureBootCertificate=mkosi.crt
|