dotfiles/.chezmoi.toml.tmpl

47 lines
1.7 KiB
Cheetah
Raw Normal View History

# This .chezmoi.toml file is used once only
# It collects information about the system in order to determine
# which of the _home.* dirs will be set as the .chezmoiroot
2025-03-12 14:55:31 +00:00
{{- $githubToken := promptStringOnce . "githubToken" "Public GITHUB token (mostly for rate limits - !insecure!)" (or (
env "CZ_GITHUB_ACCESS_TOKEN"
) ( env "CHEZMOI_GITHUB_ACCESS_TOKEN"
) ( env "GITHUB_ACCESS_TOKEN"
) ( env "GITHUB_TOKEN"
)) -}}
2025-04-15 17:44:39 +00:00
{{- $scriptTempDir := or (env "CZ_SCRIPT_TEMPDIR") "~/.cache/chezmoi/tmp" }}
{{- $chassisType := "desktop" }}
{{- $sysType := "posix" }}
2025-03-10 20:49:05 +00:00
{{- $sysVendor := "unknown" }}
{{- if eq .chezmoi.os "darwin" }}
{{- $sysType = "macos" }}
{{- $sysVendor = "apple" }}
{{- if contains "BatteryData" (output "ioreg" "-c" "AppleSmartBattery") }}
{{- $chassisType = "laptop" }}
{{- else }}
{{- $chassisType = "desktop" }}
{{- end }}
{{- else if eq .chezmoi.os "linux" }}
{{- $chassisType = or (and
(lookPath "hostnamectl") (output "hostnamectl" "--json=short" | mustFromJson).Chassis
)
"server"
}}
{{- else if eq .chezmoi.os "windows" }}
{{- $sysType = "windows" }}
{{- $sysVendor = "pc" }}
{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }}
2025-04-15 17:44:39 +00:00
{{- end -}}
2025-04-15 17:44:39 +00:00
#
scriptTempDir={{- $scriptTempDir | quote }}
[scriptEnv]
CZ_SCRIPT_TEMPDIR={{- $scriptTempDir | quote }}
CZ_CHASSIS={{- $chassisType | quote }}
CZ_SYS={{- $sysType | quote }}
CZ_OS={{- .chezmoi.os | quote }}
2025-03-12 14:55:31 +00:00
CZ_GITHUB_ACCESS_TOKEN={{- $githubToken | quote }}
CZ_VENDOR={{- $sysVendor | quote }}