Files
agent-mkosi/mkosi.conf
T
2026-11-15 15:52:10 +01:00

125 lines
4.5 KiB
Plaintext

# agent: a Fedora VM image that runs Claude Code in the background, built with mkosi.
# mkosi.extra/ is copied to /, mkosi.repart/ defines the disk, mkosi.prepare adds Claude Code.
# The root filesystem, /etc included, is read-only and replaced whole by updates; all state lives
# on /var. Claude can't change the OS: it runs its tools in containers.
[Distribution]
Distribution=fedora
Release=45
[Output]
Format=disk
ImageId=agent
OutputDirectory=mkosi.output
# The UKI and root partitions are published as updates (systemd-sysupdate).
SplitArtifacts=uki,partitions
[Content]
Bootable=yes
Bootloader=systemd-boot
# - kernel-core no drivers or firmware beyond what VMs need
# - systemd-container, gnupg2 systemd-pull, which systemd-sysupdate downloads with, and gpg,
# which it checks their signature with
# - systemd-boot-unsigned the bootloader
# - util-linux, shadow-utils console login, setup, newuidmap for rootless podman
# - systemd-pam login sessions (pam_systemd): Claude's user manager and its
# D-Bus, which rootless podman needs
# - openssh-server ssh login for the user (keys only)
# - nftables-services the firewall
# - zram-generator-defaults compressed swap in RAM
# - podman, podman-docker containers, for all of Claude's toolchains (also as docker)
# - git-core, openssh-clients Claude Code uses git; it 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
nftables-services
zram-generator-defaults
podman
podman-docker
git-core
openssh-clients
curl
tar
gzip
xz
zstd
diffutils
findutils
procps-ng
iproute
WithDocs=no
Locale=C.UTF-8
# The UKI's file name in the ESP, as systemd-sysupdate names the ones it installs.
UnifiedKernelImageFormat=%i_%v
# The console on screen and serial port, the machine ID from the VM's firmware
# (mkosi.extra/etc/machine-id is empty, so no boot counts as the first), no systemd-firstboot
# questions (agent-setup asks its own), freeing memory unused for an hour (damon_reclaim, in µs; the
# watermarks make it run whatever memory is free), so the host can take it back (virtio-balloon
# free page reporting), and KSPP hardening (the last four).
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
slab_nomerge
init_on_alloc=1
randomize_kstack_offset=on
page_alloc.shuffle=1
# Kernel modules in the initrd: only what finds and mounts the disks of a VM.
KernelInitrdModules=
virtio_blk
virtio_scsi
sd_mod
nvme
dm-verity
erofs
ext4
# Kernel modules in the image: all but the hardware drivers, then the drivers of a VM (disks,
# network, screen) and 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, nsresourced unused services
# - sshd-keygen sshd uses one host key, kept on /var (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*