Reference
Reference: Template Variables
The variables and helpers available to chezmoi templates (.tmpl files) under defaults/.
From .chezmoidata.toml
Flat top-level keys (values as shipped, before any chezmoi.toml override):
| Variable | Type | Example |
|---|---|---|
.dotfiles_version | string | "0.2.542" |
.theme | string | "maui-dark" |
.theme_family | string | "maui" |
.theme_mode | string | "auto" |
.machine | string | "" (or a preset such as "macbook-t2") |
.profile | string | "laptop" |
.default_shell | string | "fish" |
.terminal_font_family | string | "JetBrainsMono Nerd Font" |
.terminal_font_size | int | 20 |
.name | string | "" |
.email | string | "" |
.features | table | see Feature Flags |
chezmoi init also writes .git_name, .git_email, .git_signingkey, .git_signingformat, .age_identity and .age_recipient into ~/.config/chezmoi/chezmoi.toml.
From .theme-manifest/themes.toml
The theme manifest is not chezmoi data (it is too large to hand to every template), so a template loads it and resolves the active theme through the theme-name partial, which falls back to fallback-dark when .theme is missing:
// "dark" or "light"
// "maui"
// 4 (integer)
// "#0f1f21"
// "#f1f6f7"
.. // ANSI 0-15
// "#00d2e0"
// "#000000"
// "tokyonight"
The example values are those of maui-dark.
From .chezmoidata/hardware.toml
.hardware holds the defaults and .machines the presets; a template picks the preset named by .machine, as defaults/dot_config/niri/config.kdl.tmpl does:
// 2.0 on macbook-t2
// bool
// 60
// "us"
// "eDP-1"
// "laptop" | "desktop"
From Feature Flags
Flags are read straight from .features; presets carry no flags of their own:
# Niri WM config
Built-in Chezmoi Variables
// "darwin" | "linux" | "windows"
// "amd64" | "arm64"
// "Linux" (Linux only)
// kernel release; contains "microsoft" on WSL (Linux only)
// host machine hostname
// current user
// $HOME
// ~/.dotfiles/defaults (the .chezmoiroot)
// git working tree root (~/.dotfiles)
// chezmoi binary path
// Linux /etc/os-release data
Built-in Chezmoi Functions
Functions the templates here use:
// returns path or empty
See the chezmoi template reference for the rest.
Helper Templates (in .chezmoitemplates/)
Named partials, included with template or includeTemplate:
Available partials:
theme-name: resolve the active theme name, with thefallback-darkfallbackgo-build-command: the build step shared by therun_onchange_24/25/26-build-*scripts (dot-ui, dot-ai-tui, dot-mcp)desktop/shell-theme.dconf.tmpl: GNOME Shell theme settings
The same directory holds the alias and function sources: aliases/<group>/*.aliases.sh are gathered by dot_config/shell/91-ux-aliases-lazy.sh.tmpl with glob, and functions/<group>/*.sh are listed in functions/groups.json for the fish and nushell function files.
Example: Using Theme in Ghostty Config
An excerpt of defaults/dot_config/ghostty/config.tmpl:
background =
foreground =
cursor-color =
palette = 0=
palette = 1=
# ... through 15
gtk-tabs-location = top
copy-on-select = clipboard
Example: Platform × Preset
An excerpt of the Niri template's output block:
output "{{ $hw.output_name }}"
Template Testing
Render a template without applying (from ~/.dotfiles):
Or test an expression:
# linux
# #0f1f21
Validation in CI
Every pull request to main, and every push to main, that touches shell scripts, templates or dot_* sources runs, on Linux and macOS (ci.yml):
If any template fails to render, the build breaks before merge.