docs: Add example for installing AUR packages in ArchLinux images#4250
docs: Add example for installing AUR packages in ArchLinux images#4250estebanpuyanas wants to merge 9 commits intosystemd:mainfrom
Conversation
Co-Authored By: Claude Sonnet 4.6 <noreply@anthropic.com>
behrmann
left a comment
There was a problem hiding this comment.
Thanks! This is an interesting writeup, though I'm not entirely sure the upstream docs are the best place for it in this form, since advocating for any AUR helper is really mkosi's place.
A few thoughts I had while skimming it.
Minor syntax changes; removed reflector and opted for default mkosi mirror image; expanded section on nobody user to include explenation of EUID; removed systemd and bash as BuildPackage dependecies as they are included in base.
| # Pacman initialization operations: | ||
| pacman-key --init | ||
| pacman-key --populate archlinux |
There was a problem hiding this comment.
This shouldn't be necessary, since mkosi will have already installed the base system
There was a problem hiding this comment.
Removing these from either script causes pacman to fail with "Public keyring not found" and "keyring is not writable" errors when attempting to verify package signatures. Happy to remove them if there's a mkosi setting that ensures the keyring is already initialized at this point, but I wasn't able to find one.
Again, adding logs of the failed build I got when removing these lines.
| Server = https://fastly.mirror.pkgbuild.com/$repo/os/$arch | ||
| EOF | ||
|
|
||
| pacman -Sy |
There was a problem hiding this comment.
This should also not be necessary, since packages have just been installed.
There was a problem hiding this comment.
Without these lines, pacman -S fails with "no servers configured for repository" and "database file does not exist" errors. The postinst script has the same requirement. If mkosi already handles this in a way I am missing, I'd appreciate guidance on the correct approach.
I am also attaching logs of a failed build after removing these lines where the server failed to sync databases.
Add example for installing AUR packages in Arch-based images
Adds a documentation file under
mkosi/docsexplaining how to install AUR packages at image build time usingaurutilsandmkosi's$PACKAGEDIRmechanism.The example uses
neovim-gitas a worked case because it has both official-repomakedependsand AUR dependencies, which exercises the full dependency resolution pipeline.The approach covers:
aurutilsfrom the AUR at build time.aur depends+tsortfor dependency resolution.nobodyuser to satisfymakepkg's refusal to run as root.$PACKAGEDIRto pass built packages from the build phase tomkosi.postinst.chroot.reflectorsince the build sandbox starts with none.Tested end-to-end on Arch Linux (EndeavourOS) with QEMU. The image builds successfully and
nvim --versionconfirms correct installation after booting.Closes #2578