Update file .chezmoi.yaml.tmpl

This commit is contained in:
Brian Zalewski 2023-01-05 09:29:03 +00:00
parent e6ef9ea7f6
commit c9a60e3084

View file

@ -48,6 +48,25 @@
{{- writeToStdout "Chezmoi is running in a container.\n" -}} {{- writeToStdout "Chezmoi is running in a container.\n" -}}
{{- end -}} {{- end -}}
{{- $chassisType := "desktop" }}
{{- if $ephemeral -}}
{{- $chassisType = "ephemeral" }}
{{- else if eq .chezmoi.os "linux" }}
{{- if (.chezmoi.kernel.osrelease | lower | contains "microsoft") -}}
{{- $chassisType = "wsl" }}
{{- else -}}regexFind "[a-zA-Z][1-9]" "abcd1234"
{{- $chassisType = (regexFind "Chassis: .*" "(output "hostnamectl") | replace "Chassis: " "") }}
{{- end -}}
{{- else if eq .chezmoi.os "darwin" }}
{{- if contains "MacBook" (output "sysctl" "-n" "hw.model") }}
{{- $chassisType = "laptop" }}
{{- else }}
{{- $chassisType = "desktop" }}
{{- end }}
{{- else if eq .chezmoi.os "windows" }}
{{- $chassisType = (output "powershell.exe" "-noprofile" "-command" "if (Get-WmiObject -Class win32_battery -ComputerName localhost) { echo laptop } else { echo desktop }") }}
{{- end }}
{{- $cpuCores := 1 }} {{- $cpuCores := 1 }}
{{- $cpuThreads := 1 }} {{- $cpuThreads := 1 }}
{{- if eq .chezmoi.os "darwin" }} {{- if eq .chezmoi.os "darwin" }}
@ -172,6 +191,7 @@ data:
hostname: "Betelgeuse" hostname: "Betelgeuse"
qubes: {{ ne (stat (joinPath "usr" "bin" "qubes-session")) false }} qubes: {{ ne (stat (joinPath "usr" "bin" "qubes-session")) false }}
softwareGroup: "{{ $softwareGroup }}" softwareGroup: "{{ $softwareGroup }}"
type: "{{ $chassisType }}"
work: {{ $work }} work: {{ $work }}
restricted: {{ $restricted }} restricted: {{ $restricted }}
headless: {{ $headless }} headless: {{ $headless }}