Per-jail Package Repository Selection

I run several applications in my homelab using FreeBSD jails. This provides an extra measure of isolation, since the services are connected to the internet. I use AppJail to keep the setup declarative and introduce a reasonable measure of reproducibility. It's not NixOS, but it's good enough for me. This short post is because I hit an interesting split between 2 jailed services' needs.

One application (continuwuity) is not yet in the ports tree, but there are great packages available from the community. The package, which isn't part of the ports CI, needs to make a decision about a library it depends on. They chose the quarterly ports tree for simplicity (this is the default on new FreeBSD installations).

Another package I use (marmite) is the static site generator I use for this blog. That is in the ports tree, but I want to always use the bleeding edge release. Most recently because I submitted a patch switching to Arborium for build-time syntax highlighting. I could build it from source, but that means I'd need to take a few minutes to rebuild the jail from scratch. Using packages takes a few seconds.

AppJail releases will use Quarterly by default. The default AppJail release process uses a standard base system, and thus points at the quarterly branch. Changing any specific jail to use the latest is pretty easy! You can basically copy from handbook.

# Use the latest ports branch to get updates faster
CMD mkdir -p /usr/local/etc/pkg/repos
CMD echo 'FreeBSD-ports: { url: "pkg+https://pkg.FreeBSD.org/${ABI}/latest" }' > /usr/local/etc/pkg/repos/FreeBSD.conf

# Update package database
PKG --update

You can put this directly in your Makejail file, or extract it into a separate include file for reusability. And that's it; just make sure this comes before your first PKG instruction. Now any future PKG instructions will use the bleeding edge.

Posts from blogs I follow

Four levels of in-place initialization

IntroductionThe goal of in-place initialization is to enable the construction of types directly into a memory location without any additional moves or copies. When working with big types this can be more efficient and even prevent stack ove...

via Yosh Wuyts β€” Blog

Against Chat

The most prevalent interface of recent fame is undeniably the chat window. Today it feels ubiquitous, to the extent that almost all interactions gravitate toward a single indistinguishable blob. This seems due in large part to an assumpti...

via Max's Homepage

Generating a Neovim Reference Card with Nix

I started learning emacs the other day, and I happened to stumble upon this reference card, designed by Stephen Gildea: It’s beautiful (and GPLv3)! So naturally I wanted to make my own. My initial concern wa...

via Andrew Zah

Generated by openring-rs from my blogroll.