Skip to main content

Overview

The dotfiles support three machine types that control which configurations are applied:
  • personal: Personal machine with personal email and repositories
  • work: Work machine with work email and repositories
  • hybrid: Machine used for both personal and work with conditional configurations

Configuration Template

Machine type is configured during chezmoi initialization in .chezmoi.toml.tmpl:
.chezmoi.toml.tmpl
{{- $name := promptStringOnce . "name" "Your Name" "Julio Lira" -}}
{{- $machine_type := promptStringOnce . "machine_type" "Machine type (personal/work/hybrid)" "hybrid" -}}
{{- $os := promptStringOnce . "os" "Operating System" "linux" -}}
{{- $editor := promptStringOnce . "editor" "Default Editor" "code" -}}

{{- $personal_email := "" -}}
{{- if or (eq $machine_type "personal") (eq $machine_type "hybrid") -}}
{{-   $personal_email = promptStringOnce . "personal_email" "Personal Email" "" -}}
{{- end -}}

{{- $work_email := "" -}}
{{- if or (eq $machine_type "work") (eq $machine_type "hybrid") -}}
{{-   $work_email = promptStringOnce . "work_email" "Work Email" "" -}}
{{- end -}}

Conditional Prompts

Personal Email

Prompted only for personal or hybrid machines:
{{- if or (eq $machine_type "personal") (eq $machine_type "hybrid") -}}
{{-   $personal_email = promptStringOnce . "personal_email" "Personal Email" "" -}}
{{- end -}}

Work Email

Prompted only for work or hybrid machines:
{{- if or (eq $machine_type "work") (eq $machine_type "hybrid") -}}
{{-   $work_email = promptStringOnce . "work_email" "Work Email" "" -}}
{{- end -}}

Data Storage

All values are stored in the [data] section and accessible in templates:
.chezmoi.toml.tmpl
[data]
    name = {{ $name | quote }}
    machine_type = {{ $machine_type | quote }}
    os = {{ $os | quote }}
    editor = {{ $editor | quote }}
    personal_email = {{ $personal_email | quote }}
    work_email = {{ $work_email | quote }}

Machine Type Impact

Different machine types affect:
  • Git configuration: Which email is used as default
  • Bash aliases: Work or personal specific shortcuts
  • AWS credentials: Only configured for work/hybrid machines
  • Directory paths: WSL paths for work vs personal repositories

Editor Integration

The selected editor is used for:
.chezmoi.toml.tmpl
[edit]
    command = {{ $editor | quote }}
    args = ["--wait"]

[diff]
    command = {{ $editor | quote }}
    args = ["--wait", "--diff"]

Security

Encryption is enabled using age:
.chezmoi.toml.tmpl
encryption = "age"

[age]
    identity = "~/.config/chezmoi/key.txt"
    recipient = {{ output "age-keygen" "-y" (joinPath .chezmoi.homeDir ".config/chezmoi/key.txt") | trim | quote }}

Bitwarden Integration

Bitwarden CLI is configured for secret management:
.chezmoi.toml.tmpl
[bitwarden]
    command = "bw"
    unlock = "auto"

Build docs developers (and LLMs) love