-
Notifications
You must be signed in to change notification settings - Fork 0
/
.chezmoi.toml.tmpl
90 lines (81 loc) 路 2.84 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
80
81
82
83
84
85
86
87
88
89
90
{{/* vim: set filetype=gotmpl.toml : */}}
{{- $decrypt := false -}}
{{- $ephemeral := false -}}
{{- $headless := false -}}
{{- $hostname := .chezmoi.hostname -}}
{{- $identity := joinPath .chezmoi.homeDir ".config/chezmoi/key.txt" -}}
{{- $personal := false -}}
{{- $work := false -}}
{{/* */}}
{{/* Detect GitHub CodeSpaces, VSCode remote containers, Docker/Podman containers. */}}
{{- if or (env "CODESPACES") (env "REMOTE_CONTAINERS_IPC") (eq .chezmoi.username "root" "ubuntu" "vscode") -}}
{{- $ephemeral = true -}}
{{- $headless = true -}}
{{- end -}}
{{/* Determine what kind of computer this is. */}}
{{- $chassisType := "desktop" -}}
{{- $chassisType = (output (joinPath .chezmoi.sourceDir ".chezmoiscripts/.01-hostnamectl.sh") | mustFromJson ).Chassis -}}
{{/* */}}
{{/* Work around unreliable hostname on macOS */}}
{{- if eq .chezmoi.os "darwin" -}}
{{- $hostname = (output (joinPath .chezmoi.sourceDir ".chezmoiscripts/.01-hostnamectl.sh") | mustFromJson ).Hostname -}}
{{- end -}}
{{/* */}}
{{/* Boolean settings. */}}
{{- if not $ephemeral -}}
{{- if regexMatch "^dsully-" $hostname -}}
{{- $work = true -}}
{{- else if regexMatch "\\.biz$" $hostname -}}
{{- $work = true -}}
{{- else if regexMatch "\\.corp\\." $hostname -}}
{{- $work = true -}}
{{- else if eq $hostname "jarvis" "server" "zap" -}}
{{- $personal = true -}}
{{- else -}}
{{- $ephemeral = true -}}
{{- end -}}
{{- end -}}
{{/* */}}
{{- if not (eq $chassisType "desktop" "laptop") -}}
{{- $headless = true -}}
{{- end -}}
{{/* */}}
{{/* Extract TOML data out of the config file. */}}
{{- $data := "" -}}
{{/* */}}
{{- if and (stat $identity) (stat (joinPath .chezmoi.homeDir ".config/chezmoi/chezmoi.toml")) -}}
{{- $data = include (joinPath .chezmoi.sourceDir "dot_config/chezmoi/encrypted_private_data.toml.age") | decrypt -}}
{{- $decrypt = true }}
{{- else if not $ephemeral -}}
{{- writeToStdout "WARNING: Please re-run chezmoi init again to complete chezmoi.yaml data setup.\n\n" -}}
{{- end -}}
{{/* */}}
color = true
encryption = "age"
progress = "true"
[age]
identity = "{{- $identity -}}"
recipient = "age1agm9desexf47g2mp02zeqq98fcvpxjmq2sg3k8d30w5ych5xj3mqx8lgn5"
[data]
chezmoi.chassis = "{{ $chassisType }}"
chezmoi.hostname = "{{ $hostname }}"
flags.decrypt = {{ $decrypt }}
flags.ephemeral = {{ $ephemeral }}
flags.headless = {{ $headless }}
flags.personal = {{ $personal }}
flags.work = {{ $work }}
{{ $data }}
[diff]
exclude = [ "scripts" ]
[edit]
command = "nvim"
[merge]
args = [ "-d", {{ "{{ .Destination }}" | quote }}, {{ "{{ .Source }}" | quote }}, {{ "{{ .Target }}" | quote }} ]
command = "nvim"
[status]
exclude = [ "scripts" ]
# https://www.chezmoi.io/user-guide/tools/diff/#show-human-friendly-diffs-for-binary-files
[[textconv]]
args = [ "-convert", "xml1", "-o", "-", "-" ]
command = "plutil"
pattern = "**/*.plist"