Skip to content

Commit acd04c9

Browse files
committed
rework templating, adding variables for is_work, is_personal, is_desktop, etc
1 parent 928f312 commit acd04c9

8 files changed

+30
-6
lines changed

.chezmoi.toml.tmpl

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ identity = '~/.keys/age.key'
88
recipient = 'age1v9umzaqlw3euuwd20l605qeyqp9cmqxf3flzz0eh9gj5vxslsarq6fy8gs'
99

1010
[data]
11-
# TODO is there a more compact way to do this?
12-
system_profile = {{- if or (eq .chezmoi.hostname "redstar") (eq .chezmoi.hostname "bluestar") }} 'personal' {{ else if eq .chezmoi.hostname "silverstar" }} 'work' {{ else }} 'server' {{ end }}
11+
is_personal = {{- if or (eq .chezmoi.hostname "redstar") (eq .chezmoi.hostname "bluestar") }} true {{ else }} false {{ end }}
12+
is_work = {{- if eq .chezmoi.hostname "silverstar" }} true {{ else }} false {{ end }}
13+
is_desktop = {{- if eq .chezmoi.hostname "redstar" }} true {{ else }} false {{ end }}
14+
is_laptop = {{- if or (eq .chezmoi.hostname "bluestar") (eq .chezmoi.hostname "silverstar") }} true {{ else }} false {{ end }}
15+
is_server = {{- if not (or .is_personal .is_work) }} true {{ else }} false {{ end }}
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
local_{{ .system_profile }}.bash
1+
{{- if .is_personal }}
2+
local_personal.bash
3+
{{- else if .is_work }}
4+
local_work.bash
5+
{{- else }}
6+
local_server.bash
7+
{{- end }}

dot_config/exact_git/symlink_config-server.private

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
config-{{ .system_profile }}.private
1+
{{- if .is_personal }}
2+
config_personal.private
3+
{{- else if .is_work }}
4+
config_work.private
5+
{{- else }}
6+
config_server.private
7+
{{- end }}

dot_m2/symlink_settings.xml.tmpl

+7-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
{{ .chezmoi.homeDir }}/.config/maven/settings-{{ .system_profile }}.xml
1+
{{- if .is_personal }}
2+
{{ .chezmoi.homeDir }}/.config/maven/settings-personal.xml
3+
{{- else if .is_work }}
4+
{{ .chezmoi.homeDir }}/.config/maven/settings-work.xml
5+
{{- else }}
6+
{{ .chezmoi.homeDir }}/.config/maven/settings-server.xml
7+
{{- end }}

exact_dot_etc/sshd.conf.tmpl

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
LogLevel VERBOSE
22
LoginGraceTime 20m
33
PermitRootLogin no
4+
{{- if and .is_personal .is_desktop }}
5+
PasswordAuthentication yes
6+
{{- else }}
47
PasswordAuthentication no
8+
{{- end }}
59
PermitEmptyPasswords no
610
KbdInteractiveAuthentication no
711
AuthenticationMethods publickey

0 commit comments

Comments
 (0)