Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

92.10. chezmoi-2.72.2

Manage dotfiles across machines from one source of truth

Version 2.72.2, release 1
Shelf cli — Command-line productivity utilities: search, view, navigation and text wrangling in the terminal
Phase 41_system (System), 291 of 1047 in build order
Licence MIT
Homepage https://www.chezmoi.io/
Build time 0.8 SBU
Installed size 43.0 MiB in 2 files
Recipe ports/core/cli/chezmoi/kpkgbuild

About

chezmoi manages dotfiles across machines: it keeps the wanted state of your home directory’s configuration files in a source directory, usually a Git repository, and applies it, with templates for what differs between machines and encrypted files for secrets.

Sources

Dependencies

Depends on: go.

Required by: no port names it.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install chezmoi'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/cli/chezmoi.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/cli/chezmoi
echo '977c779f616ebf3d49700ceca426d61f367e2850ff397d3ae95ca32d7f954309  chezmoi-2.72.2.tar.gz' | sha256sum -c -
echo 'c3b6336a2c091c3d5a8f1db779fdabdb9e436f4b4b3d6178f15eef63e21a2fdd  chezmoi-vendor-2.72.2.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/chezmoi
SRC=$SRC_ROOT/chezmoi-2.72.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf chezmoi-2.72.2.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz

export CGO_ENABLED=0
go build -mod=vendor -tags noupgrade \
	-ldflags "-s -w -X main.version=$version -X main.builtBy=kdos" \
	-o chezmoi
install -Dm755 chezmoi $PKG/usr/bin/chezmoi

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/chezmoi, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf chezmoi-2.72.2-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/chezmoi, and runs the triggers its paths call for.

Contents

Installed programs: chezmoi.

Installed directories: /usr/share/licenses/chezmoi.

Notes

chezmoi is a pure Go program, built with cgo off from a vendor bundle, chezmoi-vendor-<version>.tar.xz, which ports/fetch makes with go mod vendor; see Vendoring.