Skip to content

Setup

The chosen configuration controls the behavior during these sequential steps:

  • Repository cloning
  • chezmoi initialization
  • chezmoi application of dotfiles from the source directory on the target directory.

Environment Variables

Environment variables that determine the templating environment:

envvardescriptionallowed valuesdefault valueon invalid value
DOTFILES_VERBOSEEnable verbose output for operations"true", "false""false"Use default
DOTFILES_PROFILEProfile name"personal", "quantica""personal"Use default
DOTFILES_APPLYControls if the --apply flag is passed during initialization"true", "false""true"WARNING; Use default
DOTFILES_GIT_BRANCHGit branch or ref to checkoutAny valid git ref"HEAD"WARNING; Disable chezmoi apply
DOTFILES_DEVBOX_ENABLEDEnable or disable Devbox"true", "false""true"ERROR

They are used once during chezmoi initialization to set template data dynamically in .chezmoi.yaml.tmpl, which results in the final ~/.config/chezmoi/chezmoi.yaml that is installed, which contains static template data. Example:

sh
DOTFILES_PROFILE=personal chezmoi init

or

sh
export DOTFILES_PROFILE=personal
chezmoi init

or simply using envrar auto-loading (Mise) as

sh
chezmoi init

If .chezmoi.yaml.tmpl is modified, ~/.config/chezmoi/chezmoi.yaml can be re-generated by re-initializing chezmoi as chezmoi init (using the current source repo), providing the necessary envvars.

DevPod

Environment variables can be made available to devpod installation of dotfiles by option --dotfiles-script-env ENVVAR=VALUE,... or --dotfiles-script-env-file env_file.... Example using default profile:

sh
devpod up . --dotfiles-script-env DOTFILES_PROFILE=personal

or

sh
devpod up . --dotfiles-script-env-file path/to/env/file

~/.dotfiles.env file is to contain envars used to configure the chezmoi dynamic template initialization. As a conventional dotenv file (KEY=VALUE pairs), it can be passed to devpod as

sh
devpod up path/to/repo/ --dotfiles-script-env-file=~/.dotfiles.env

Additionally it is made available by Mise in the home environment so that chezmoi init uses its current config without having to pass envvars explicitly.

Auto-Loading Environment Variables

With Mise

It is the preferred way, as it is more efficient, clean, and does not rely on external dependencies like Devbox does on Direnv. Mise centralizes the management of packages, environment variables and tasks. Mise environments activation, both global and per-project, is managed through a Bash init hook.

Global Mise environments are selected in ~/.miserc.toml ("devbox,opt" by default). This file is generated on first chezmoi apply via home/create_dot_miserc.toml and never overwritten afterwards, allowing per-machine customization.

Installation Script

The cloned dotfiles Git repository will be configured with the personal profile email address, even in an environment with another profile.