{{- /* Detect if running in WSL first (needed for chassis detection) */ -}} {{- $wsl := false -}} {{- if eq .chezmoi.os "linux" -}} {{- $wsl = (.chezmoi.kernel.osrelease | lower | contains "microsoft") -}} {{- end -}} {{- /* Detect chassis type (likely: laptop | desktop | container) */ -}} {{- /* Chassis type mapping: https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.6.0.pdf */ -}} {{- $chassisType := "desktop" }} {{- if eq .chezmoi.os "darwin" }} {{- if contains "MacBook" (output "sysctl" "-n" "hw.model") }} {{- $chassisType = "laptop" }} {{- else }} {{- $chassisType = "desktop" }} {{- end }} {{- else if and (eq .chezmoi.os "linux") (not $wsl) }} {{- $chassisRaw := output "cat" "/sys/class/dmi/id/chassis_type" | trim }} {{- if or (eq $chassisRaw "8") (eq $chassisRaw "9") (eq $chassisRaw "10") (eq $chassisRaw "14") }} {{- $chassisType = "laptop" }} {{- else if or (eq $chassisRaw "3") (eq $chassisRaw "4") (eq $chassisRaw "5") (eq $chassisRaw "6") (eq $chassisRaw "7") }} {{- $chassisType = "desktop" }} {{- else }} {{- $chassisType = "desktop" }} {{- end }} {{- else if or (eq .chezmoi.os "windows") $wsl }} {{- $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 }} {{- end }} {{- /* Detect number of CPU cores and threads */ -}} {{- $cpuCores := 1 }} {{- $cpuThreads := 1 }} {{- if eq .chezmoi.os "darwin" }} {{- $cpuCores = (output "sysctl" "-n" "hw.physicalcpu_max") | trim | atoi }} {{- $cpuThreads = (output "sysctl" "-n" "hw.logicalcpu_max") | trim | atoi }} {{- else if eq .chezmoi.os "linux" }} {{- $cpuThreads = (output "nproc" "--all") | trim | atoi }} {{- $cpuCores = (output "sh" "-c" "lscpu | grep 'Core(s) per socket' | awk '{print $4}'") | trim | atoi }} {{- else if eq .chezmoi.os "windows" }} {{- $cpuCores = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "(Get-CimInstance -ClassName 'Win32_Processor').NumberOfCores") | trim | atoi }} {{- $cpuThreads = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "(Get-CimInstance -ClassName 'Win32_Processor').NumberOfLogicalProcessors") | trim | atoi }} {{- end -}} encryption = "age" [merge] command = "chezmoi-merge-helper.sh" args = [ "{{ "{{" }} .Destination {{ "}}" }}", "{{ "{{" }} .Target {{ "}}" }}", "{{ "{{" }} .Source {{ "}}" }}", ] [data] chassis = {{ $chassisType | quote }} wsl = {{ $wsl }} [diff] pager = "delta" scriptContents = false [data.cpu] cores = {{ $cpuCores }} threads = {{ $cpuThreads }} [age] identity = "{{ .chezmoi.homeDir }}/key.txt" recipient = "age1s3ctpj9lafl6qwyvd89sn448us7gdzd53d8yyhsc7zny78c0k4sqerrkze" [doppler] project = "dotfiles" config = "production" [hooks.init.pre] command = "bun" args = ["{{ .chezmoi.sourceDir }}/hooks/.init_pre.ts"] [hooks.update.pre] command = "bun" args = ["{{ .chezmoi.sourceDir }}/hooks/.update_pre.ts"] {{ if eq .chezmoi.os "windows" }} [cd] command = "powershell.exe" args = ["-NoLogo"] {{ else }} [cd] command = "fish" {{ end }}