-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.chezmoi.toml.tmpl
90 lines (80 loc) · 3.46 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
# chezmoi's machine specific config file
#
# Here we determine and setup the required dotfiles for this specific machine
# For example: a server without a (graphical) X server won't require
# qutebrowser dotfiles, so we set a variable here that will be used in
# templates as parameter to exclude those files
{{/* Default values, should provide the bare minimum of dotfiles */}}
{{- $headless := true -}}
{{- $battery := false -}}
{{- $wireless := false -}}
{{- $glibc := false -}}
{{/* check if machine has graphical capabilities */}}
{{- if (or (lookPath "X") (lookPath "Xorg")) -}}
{{- $headless = false -}}
{{- end -}}
{{/* Check if machine has a battery */}}
{{- if eq (output "sh" "-c" "test -r /sys/class/power_supply; printf ${?}") ("0") -}}
{{- if gt (glob "/sys/class/power_supply/{B,b}*" | len) (0) -}}
{{- $battery = true -}}
{{- end -}}
{{- end -}}
{{/* Check if machine has a wireless NIC */}}
{{- if eq (output "sh" "-c" "test -r /sys/class/net; printf ${?}") ("0") -}}
{{- range $nic := glob "/sys/class/net/*" -}}
{{- if eq (output "sh" "-c" (cat "test -d" $nic "; printf ${?}")) ("0") -}}
{{- if (joinPath $nic "/wireless" | stat) -}}
{{- $wireless = true -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* Check if machine has glibc installed
* Needed for glibc dependent binaries like most AppImages
* Note: glibc ldconfig has --version flag, musl doesn't */}}
{{- if eq (output "sh" "-c" "ldconfig --version 1>/dev/null 2>&1; printf ${?}") ("0") -}}
{{- $glibc = true -}}
{{- end -}}
{{/* Let user select preferred colorscheme/theme, if not headless */}}
{{- $colorscheme_choices := list "selenized_black" "selenized_white" "selenized_dark" "selenized_light" -}}
{{- $colorscheme := "selenized_light" -}}
{{- if eq $headless false -}}
{{- $colorscheme = promptChoice "Selenized colorscheme to use: " $colorscheme_choices "selenized_light" -}}
{{- end -}}
{{/* Determine if system supports AppImages */}}
{{- $appimage_archs := list "amd64" -}}
{{- $appimage_os := list "linux" -}}
{{- $appimage := and (has .chezmoi.os $appimage_os) (has .chezmoi.arch $appimage_archs) ($glibc) -}}
{{/* Infos about current system */}}
# Current machine values detected by chezmoi v{{ .chezmoi.version.version }}
# hostname = {{ .chezmoi.hostname }}
# os = {{ .chezmoi.os }}
{{- if eq .chezmoi.os "linux" }}
# kernel = {{ .chezmoi.kernel.ostype }} {{ .chezmoi.kernel.osrelease }} {{ .chezmoi.kernel.version }}
{{- end }}
# arch = {{ .chezmoi.arch }}
# user = {{ .chezmoi.username }} ({{ .chezmoi.uid }})
# home = {{ .chezmoi.homeDir }}
[data]
# Whether machine is without graphical environment (X server)
headless = {{ $headless }}
# Whether machine has a battery
battery = {{ $battery }}
# Whether machine has a wireless device
wireless = {{ $wireless }}
# Whether glibc (standard C library) is installed (required for most AppImages)
# Binaries compiled with `musl` are compatible with `glibc` powered distros
# but glibc binaries are not compatible with musl distros (like Alpine Linux).
# So this variable can be used to ignore glibc dependent apps on musl systems
glibc = {{ $glibc }}
appimage = {{ $appimage }}
# Select what theme to use for applications supporting theme selection/color changing
# Currently using only Selenized themes with vim, i3, rofi
# The user can select the colorscheme
# Available options:
# - selenized_white
# - selenized_light
# - selenized_black
# - selenzied_dark
colorscheme = {{ $colorscheme | quote }}
# vim: filetype=toml