Skip to content

Variables

chezmoi provides the following automatically-populated variables:

Variable Type Value
.chezmoi.arch string Architecture, e.g. amd64, arm, etc. as returned by runtime.GOARCH
.chezmoi.args []string The arguments passed to the chezmoi command, starting with the program command
.chezmoi.cacheDir string The cache directory
.chezmoi.configFile string The path to the configuration file used by chezmoi
.chezmoi.executable string The path to the chezmoi executable, if available
.chezmoi.fqdnHostname string The fully-qualified domain name hostname of the machine chezmoi is running on
.chezmoi.group string The group of the user running chezmoi
.chezmoi.homeDir string The home directory of the user running chezmoi
.chezmoi.hostname string The hostname of the machine chezmoi is running on, up to the first .
.chezmoi.kernel string Contains information from /proc/sys/kernel. Linux only, useful for detecting specific kernels (e.g. Microsoft's WSL kernel)
.chezmoi.os string Operating system, e.g. darwin, linux, etc. as returned by runtime.GOOS
.chezmoi.osRelease string The information from /etc/os-release, Linux only, run chezmoi data to see its output
.chezmoi.sourceDir string The source directory
.chezmoi.sourceFile string The path of the template relative to the source directory
.chezmoi.username string The username of the user running chezmoi
.chezmoi.version.builtBy string The program that built the chezmoi executable, if set
.chezmoi.version.commit string The git commit at which the chezmoi executable was built, if set
.chezmoi.version.date string The timestamp at which the chezmoi executable was built, if set
.chezmoi.version.version string The version of chezmoi
.chezmoi.workingTree string The working tree of the source directory

Additional variables can be defined in the config file in the data section. Variable names must consist of a letter and be followed by zero or more letters and/or digits.

Hint

Until #463 is resolved, custom data fields from the data section appear as all lowercase strings.

Back to top