Repository navigation
Expand file tree
/
Copy path.chezmoi.toml.tmpl
More file actions
66 lines (56 loc) · 2.35 KB
/
Copy path.chezmoi.toml.tmpl
File metadata and controls
66 lines (56 loc) · 2.35 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{{- $email := "cwopel@chlorm.net" -}}
{{- $headless := true -}}
{{- $isLinux := false -}}
{{- $isMacos := false -}}
{{- $isWindows := false -}}
{{- if eq .chezmoi.os "linux" -}}
{{- $isLinux = true -}}
{{- else if eq .chezmoi.os "darwin" -}}
{{- $isMacos = true -}}
{{- else if eq .chezmoi.os "windows" -}}
{{- $isWindows = true -}}
{{- end -}}
{{- $isUnix := false -}}
{{- if eq .chezmoi.os "darwin" "linux" -}}
{{- $isUnix = true -}}
{{- end -}}
{{- $hostname := .chezmoi.hostname -}}
{{- if eq .chezmoi.os "darwin" -}}
{{- $hostname = output "networksetup" "-getcomputername" | quote -}}
{{- end -}}
{{- if eq $hostname "miranova" "NOS4A2" "raenok" -}}
{{- $headless = false -}}
{{- end -}}
{{- $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" }}
{{- $cpuCoresPerSocket := (output "sh" "-c" "cat /sys/devices/system/cpu/cpu*/topology/core_id | sort -u | wc -l") | trim | atoi }}
{{- $cpuThreadsPerCore := (output "sh" "-c" "cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list | tr ',' '\n' | wc -l") | trim | atoi }}
{{- $cpuSockets := (output "sh" "-c" "cat /sys/devices/system/cpu/cpu*/topology/physical_package_id | sort -u | wc -l") | trim | atoi }}
{{- $cpuCores = mul $cpuCoresPerSocket $cpuSockets }}
{{- $cpuThreads = mul $cpuCores $cpuThreadsPerCore }}
{{- else if eq .chezmoi.os "windows" }}
{{- $cpuCores = (output "pwsh.exe" "-NoProfile" "-NonInteractive" "-Command" "(Get-CimInstance -ClassName 'Win32_Processor').NumberOfCores") | trim | atoi }}
{{- $cpuThreads = (output "pwsh.exe" "-NoProfile" "-NonInteractive" "-Command" "(Get-CimInstance -ClassName 'Win32_Processor').NumberOfLogicalProcessors") | trim | atoi }}
{{- end }}
[cd]
command = 'elvish'
[data]
email = {{ $email | quote }}
headless = {{ $headless }}
hostname = {{ $hostname | quote }}
[data.os]
isLinux = {{ $isLinux }}
isMacos = {{ $isMacos }}
isWindows = {{ $isWindows }}
isUnix = {{ $isUnix }}
[data.cpu]
cores = {{ $cpuCores }}
threads = {{ $cpuThreads }}
[github]
refreshPeriod = "12h"
[interpreters.elv]
command = 'elvish'