-
Notifications
You must be signed in to change notification settings - Fork 0
/
.chezmoi.toml.tmpl
38 lines (35 loc) · 1.43 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
{{- $decrypt_secret_key_script_path := joinPath .chezmoi.sourceDir "setup" "decrypt_secret_key.sh" -}}
{{- $encrypted_secret_key_path := joinPath .chezmoi.sourceDir "age_secret_key.age" -}}
{{- output "sh" $decrypt_secret_key_script_path $encrypted_secret_key_path -}}
{{- $secret_key_path := joinPath .chezmoi.homeDir ".config" "chezmoi" "age_secret_key" -}}
{{- $public_key := $secret_key_path | include | replaceAllRegex "(.|\n)*public key: (.+)(.|\n)*" "$2" -}}
{{- $osid := .chezmoi.os -}}
{{- if hasKey .chezmoi.osRelease "id" -}}
{{- $osid = printf "%s-%s" $osid .chezmoi.osRelease.id -}}
{{- end -}}
{{- if hasKey .chezmoi.osRelease "idLike" -}}
{{- $osid = printf "%s-%s" $osid .chezmoi.osRelease.idLike -}}
{{- end -}}
{{- $usage := "" -}}
{{- $usage_number := promptIntOnce . "usege_number" "Select your usage.\n1: Private\n2: Work\n" 0 -}}
{{- if eq $usage_number 1 -}}
{{- $usage = "private" -}}
{{- else if eq $usage_number 2 -}}
{{- $usage = "work" -}}
{{- else -}}
{{- writeToStdout "Invalid number." -}}
{{- exit 1 -}}
{{- end -}}
encryption = "age"
[age]
identity = {{ $secret_key_path | quote }}
recipient = {{ $public_key | quote }}
[edit]
command = "code"
args = ["--wait"]
[merge]
command = "code"
args = ["--wait", "--merge", "{{ `{{ .Destination }}` }}", "{{ `{{ .Target }}` }}", "{{ `{{ .Source }}` }}", "{{ `{{ .Source }}` }}"]
[data]
osid = {{ $osid | quote }}
usage = {{ $usage | quote }}