If you’re packaging chezmoi for an operating system or distribution, this guide provides essential information to ensure a quality package.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/twpayne/chezmoi/llms.txt
Use this file to discover all available pages before exploring further.
Build Dependencies
chezmoi has no build dependencies other than the standard Go toolchain.Runtime Dependencies
chezmoi has no runtime dependencies, but is usually used withgit, so many packagers choose to make git an install dependency or recommended package.
Version Information
Please set the version number, git commit, and build time in the binary. This greatly assists debugging when end users report problems or ask for help. You can do this by passing the following flags togo build:
$VERSION
- Should be the chezmoi version, e.g.
1.7.3 - Any
vprefix is optional and will be stripped - You can pass the git tag in directly
$COMMIT
Should be the full git commit hash at which chezmoi is built, e.g. 4d678ce6850c9d81c7ab2fe0d8f20c1547688b91.
$DATE
Should be the date of the build as a UNIX timestamp or in RFC3339 format.
$BUILT_BY
Should be a string indicating what system was used to build the binary. Typically it should be the name of your packaging system, e.g. homebrew.
CGO Considerations
Please enable cgo, if possible. chezmoi can be built and run without cgo, but the.chezmoi.username and .chezmoi.group template variables may not be set correctly on some systems.
Upgrade Command
chezmoi includes anupgrade command which attempts to self-upgrade. You can remove this command completely by building chezmoi with the noupgrade build tag:
Shell Completions
chezmoi includes shell completions in thecompletions directory. Please include these in the package and install them in the shell-appropriate directory, if possible.
Typical installation paths:
- Bash:
/usr/share/bash-completion/completions/chezmoi - Zsh:
/usr/share/zsh/site-functions/_chezmoi - Fish:
/usr/share/fish/vendor_completions.d/chezmoi.fish - PowerShell: Check your distribution’s conventions
Using Make
You can use the provided Makefile for building and installing:- Build the binary with embedded version information
- Install it to
${DESTDIR}${PREFIX}/bin/chezmoi