-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.chezmoi.yaml.tmpl
31 lines (26 loc) · 1.08 KB
/
.chezmoi.yaml.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{{- /* Checks if running interactively */ -}}
{{- $interactive := stdinIsATTY -}}
{{- /* Template file for chezmoi config file */ -}}
{{- $headless := false -}}{{/* true if this machine does not have a screen and keyboard */}}
{{- $hostname := .chezmoi.hostname -}}
{{- if eq $hostname "jonsnow" -}}
{{- $headless = true -}}
{{- end -}}
{{- /* desktop or laptop? */ -}}
{{- $chassisType := "desktop" }}
{{- if eq .chezmoi.os "darwin" }}
{{- if contains "MacBook" (output "sysctl" "-n" "hw.model") }}
{{- $chassisType = "laptop" }}
{{- else }}
{{- $chassisType = "desktop" }}
{{- end }}
{{- else if eq .chezmoi.os "linux" }}
{{- $chassisType = (output "hostnamectl" "--json=short" | mustFromJson).Chassis }}
{{- else if eq .chezmoi.os "windows" }}
{{- $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 }}
data:
headless: {{ $headless }}
chassistype: {{ $chassisType }}
diff:
exclude: ["scripts"]