-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.chezmoi.toml.tmpl
79 lines (70 loc) · 2.88 KB
/
.chezmoi.toml.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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
{{- $devcontainer := (or (env "DEVPOD" | not | not) (env "GITPOD_WORKSPACE_ID" | not | not) (env "CODESPACES" | not | not) (env "CODER_ENV" | not | not)) -}}
{{- $wsl := (and (eq .chezmoi.os "linux") (.chezmoi.kernel.osrelease | lower | contains "microsoft")) -}}
{{- $distro := (.chezmoi.os) -}}
{{- $distroLike := (.chezmoi.os) -}}
{{- if eq $distro "linux" -}}
{{- $distro = (.chezmoi.osRelease.id) -}}
{{- $distroLike = (or (index .chezmoi.osRelease "idLike") (.chezmoi.osRelease.id)) -}}
{{- end -}}
{{- $chassisType := "desktop" -}}
{{- if $devcontainer -}}
{{- $chassisType = "ephemeral" -}}
{{- else if stat "/home/kasm-default-profile" -}}
{{- $chassisType = "kasm" -}}
{{- else if $wsl }}
{{- $chassisType = "wsl" -}}
{{- else if eq .chezmoi.hostname "beepy" -}}
{{- $chassisType = "beepy" -}}
{{- 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 "linux" -}}
{{- $chassisType = (output "hostnamectl" "--json=short" | mustFromJson).Chassis -}}
{{- 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 -}}
{{ $pokemon := false }}
{{ $email := "hey@vlad.gg" }}
{{- if (regexMatch "Mac-[A-Za-z0-9]+" .chezmoi.hostname) -}}
{{ $pokemon = true }}
{{ $email = "v.zaharia@pokemon.com" }}
{{- end -}}
sourceDir = {{ .chezmoi.sourceDir | quote }}
{{ if and (ne $chassisType "ephemeral") (ne $chassisType "beepy") -}}
encryption = "age"
[age]
{{- if $pokemon }}
identity = "~/.keys/pkmn.key"
recipient = "age1chxlg7tm275f5fsw8lfpj9x76drqfgtaphu02ef7u3lurkppwqnqfwxarn"
{{- else }}
identity = "~/.keys/personal.key"
recipient = "age1hpzuwy5lhe6ke9dkj37npz9qlgcfxkk2yyl0z235xt3sgqrmqpssqsjtcm"
{{- end }}
{{- end }}
[data]
chezmoi.chassis = {{ $chassisType | quote }}
chezmoi.distro.name = {{ $distro | quote }}
chezmoi.distro.like = {{ $distroLike | quote }}
{{ if eq $distroLike "fedora" -}}
fastfetch.color = "light_blue"
{{ else if eq $distro "ubuntu" -}}
fastfetch.color = "yellow"
{{ else if eq $distroLike "debian" -}}
fastfetch.color = "red"
{{ else if eq $distroLike "opensuse" -}}
fastfetch.color = "green"
{{ else if eq .chezmoi.os "windows" -}}
fastfetch.color = "light_blue"
{{ else if eq $distro "darwin" -}}
fastfetch.color = "light_blue"
{{ else -}}
fastfetch.color = "black"
{{ end -}}
flags.applesilicon = {{ and (eq $distro "darwin") (eq .chezmoi.arch "arm64") }}
flags.ephemeral = {{ or (eq $chassisType "ephemeral") (eq $chassisType "kasm") }}
flags.pokemon = {{ $pokemon }}
personal.name = "Vlad Zaharia"
personal.email = {{ $email | quote }}