Quick Reference

  • install syncthing and rchezmoi to sync over the chezmoi configs from another node
sudo pacman -S syncthing chezmoi && syncthing
  • chezmoi directory to add to Syncthing:
~/.local/share/chezmoi/

Variables

  • List all chezmoi variables
chezmoi data
# username
{{.chezmoi.username}}
 
# Hostname
{{.chezmoi.fqdnHostname}}
 
# Create a filepath variable and put quotes around it
{{ joinPath .chezmoi.sourceDir "/.storage/mimeapps.list" | quote }}
 
# access a chezmoi-config variable:
{{.environment}}
{{.environment | quote}}
 
 

IF

{{- if eq .environment "work" }}
 
{{ if eq .chezmoi.hostname "EXPS15"}}
 
{{ else if eq .chezmoi.os "linux" }}
 
{{ end }}

If/OR

{{- if or (eq .chezmoi.hostname "AA0438IT") (eq .chezmoi.hostname "pve-dmz-0") }}
 
 
 
 
{{ else if eq .chezmoi.os "linux" }}
 
{{ end }}

Using chezmoi data in bash scripts without making a .tmpl

environment=$(chezmoi data | jq -r '.environment')
 
if [[ "$environment" == "home" ]]; then
  echo "Environment is home"
elif [[ "$environment" == "work" ]]; then
  echo "Environment is work"
else
  echo "Environment is something else: $environment"
fi
 

Templates

Auto git push

Config File Template

Ignores

.chezmoiignore

# Ignore Fsearch Folder, fserach.conf gets updated with x/y size of windows
**/fsearch