-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.chezmoi.toml.tmpl
64 lines (57 loc) · 2.12 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
{{/* boolean feature tags */}}
{{- $personal := promptBool "personal" -}}{{/* true if this machine should have personal secrets from BitWarden */}}
{{- "" -}}
{{- $fullName := "Omar Zeghouani" -}}
{{- $bw := "" -}}
{{- $gpgKey := "" -}}
{{- $sshPublicKey := "" -}}
{{- $sshPrivateKey := "" -}}
{{ if $personal }}
{{- $bw = lookPath "rbw" -}}
{{- if or (not $bw) (output $bw "unlocked") -}}
{{- $bw = lookPath "bw" -}}
{{- if or (not $bw) (output $bw "list") -}}
{{- fail "bw not found, bootstrapping will fail.\n" -}}
{{- end -}}
{{- end -}}
{{- $gpg := lookPath "gpg" -}}
{{- if (not $gpg) -}}
{{- fail "gpg not found, bootstrapping will fail.\n" -}}
{{- end -}}
{{- $gpgKey = output $bw "get" "omarzeghouanii@gmail.com GPG short ID" | trim -}}
{{- $sshPublicKey = output $bw "get" (cat "SSH public key") | trim -}}
{{- $sshPrivateKey = output $bw "get" (cat "SSH private key") | trim -}}
{{- end -}}
{{- $gitPager := or (lookPath "delta") "less -FRSX" -}}
{{- $editor := or (base (lookPath "nvim")) "vi" -}}
{{- $isWsl := or (env "WSL_DISTRO_NAME") (env "WSLENV") | not | not -}}
{{- $isWayland := and (and (eq .chezmoi.os "linux") (not $isWsl)) (promptBool "wayland") -}}
{{- $isX11 := and (not $isWsl) (not $isWayland) (not (eq .chezmoi.os "darwin")) -}}
{{- $isLaptop := and (eq .chezmoi.os "linux") (not (not (stat "/proc/acpi/button/lid"))) -}}
{{- $osID := .chezmoi.os -}}
{{- if hasKey .chezmoi.osRelease "id" -}}
{{- $osID = printf "%s-%s" .chezmoi.os .chezmoi.osRelease.id -}}
{{- end -}}
[diff]
format = "git"
pager = {{ $gitPager | quote }}
[merge]
command = {{ (base $editor) | quote }}
args = "-d"
{{ if $personal }}
[secret]
command = {{ $bw | quote }}
{{ end }}
[data]
name = {{ $fullName | quote }}
is_personal = {{ $personal }}
gpg_key = {{ $gpgKey | trim | quote }}
ssh_public_key = {{ $sshPublicKey | trim | quote }}
ssh_private_key = {{ $sshPrivateKey | quote }}
git_pager = {{ $gitPager | quote }}
editor = {{ ($editor) | quote }}
is_laptop = {{ $isLaptop }}
is_wsl = {{ $isWsl }}
is_x11 = {{ $isX11 }}
is_wayland = {{ $isWayland }}
os_id = {{ $osID | quote }}