Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd229593aa | ||
|
|
bbda4fdbcb |
@@ -2,6 +2,8 @@
|
||||
hosts:
|
||||
# PC perso
|
||||
intel-nuc-hades-canyon:
|
||||
users:
|
||||
xavier:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
@@ -13,8 +15,15 @@ hosts:
|
||||
- pipx:speedtest-cli
|
||||
- pipx:asciinema
|
||||
configs: {}
|
||||
root:
|
||||
toolboxes:
|
||||
- terminal
|
||||
tools: []
|
||||
configs: {}
|
||||
# Serveur dédié
|
||||
cloud:
|
||||
users:
|
||||
xavier:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
@@ -23,8 +32,15 @@ hosts:
|
||||
tools:
|
||||
- pipx:vit
|
||||
configs: {}
|
||||
root:
|
||||
toolboxes:
|
||||
- terminal
|
||||
tools: []
|
||||
configs: {}
|
||||
# Container de dev
|
||||
devenv:
|
||||
users:
|
||||
xavier:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
@@ -36,9 +52,21 @@ hosts:
|
||||
- age
|
||||
- cargo:rage
|
||||
configs: {}
|
||||
root:
|
||||
toolboxes:
|
||||
- terminal
|
||||
tools: []
|
||||
configs: {}
|
||||
termux-debian:
|
||||
users:
|
||||
xavier:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
tools: {}
|
||||
configs: {}
|
||||
root:
|
||||
toolboxes:
|
||||
- terminal
|
||||
tools: []
|
||||
configs: {}
|
||||
|
||||
@@ -19,8 +19,9 @@ tools:
|
||||
- lazygit
|
||||
- delta
|
||||
- gh
|
||||
- tea
|
||||
# tea = { version = "0.14.2", url = 'https://gitea.com/gitea/tea/releases/download/v{{- "{{" }} version {{ "}}" -}}/tea-{{- "{{" }} version {{ "}}" -}}-{{- "{{" }} os() {{ "}}" -}}-{{- "{{" }} arch(x64="amd64") {{ "}}" -}}.xz' }
|
||||
- tea:
|
||||
version: "0.14.2"
|
||||
url: "https://gitea.com/gitea/tea/releases/download/v{{ version }}/tea-{{ version }}-{{ os() }}-{{ arch(x64='amd64') }}.xz"
|
||||
- jq
|
||||
- yq
|
||||
- shellcheck
|
||||
|
||||
@@ -3,18 +3,26 @@
|
||||
{{- $username := .chezmoi.username }}
|
||||
# Configuration personnalisée pour l'utilisateur {{ $username }} et l'hôte {{ $hostname }}
|
||||
{{- $currentHost := index .hosts $hostname -}}
|
||||
{{- $currentUser := "" -}}
|
||||
{{- if $currentHost }}
|
||||
{{- if hasKey $currentHost.users $username }}
|
||||
{{- $currentUser = index $currentHost.users $username -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $currentUser }}
|
||||
{{- /* 1. Parcourir les toolboxes associées à cet hôte */}}
|
||||
{{- range $toolboxName := $currentHost.toolboxes }}
|
||||
{{- range $toolboxName := $currentUser.toolboxes }}
|
||||
{{- /* Récupérer la liste des outils pour cette toolbox dans tools.yaml */}}
|
||||
{{- $toolsList := index $.tools.toolboxes $toolboxName }}
|
||||
{{- if $toolsList }}
|
||||
|
||||
# Toolbox: {{ $toolboxName }}
|
||||
{{- range $tool := $toolsList }}
|
||||
{{- /* Gestion fine du cas particulier de 'tea' mis en commentaire dans votre yaml */}}
|
||||
{{- if eq $tool "tea" }}
|
||||
tea = { version = "0.14.2", url = "https://gitea.com/gitea/tea/releases/download/v{{`{{ version }}`}}/tea-{{`{{ version }}`}}-{{`{{ os() }}`}}-{{`{{ arch(x64='amd64') }}`}}.xz" }
|
||||
{{- /* Un outil est soit une chaîne ("nom"), soit un objet { nom: {version, ...params mise} } */}}
|
||||
{{- if kindIs "map" $tool }}
|
||||
{{- range $toolName, $params := $tool }}
|
||||
{{ $toolName }} = { version = "{{ $params.version | default "latest" }}"{{ range $key, $value := omit $params "version" }}, {{ $key }} = "{{ $value }}"{{ end }} }
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
"{{ $tool }}" = "latest"
|
||||
{{- end }}
|
||||
@@ -22,16 +30,24 @@ tea = { version = "0.14.2", url = "https://gitea.com/gitea/tea/releases/download
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* 2. Parcourir les outils individuels (la liste 'tools:' du host) */}}
|
||||
{{- if hasKey $currentHost "tools" }}
|
||||
{{- if $currentHost.tools }}
|
||||
{{- /* 2. Parcourir les outils individuels (la liste 'tools:' de l'utilisateur) */}}
|
||||
{{- if hasKey $currentUser "tools" }}
|
||||
{{- if $currentUser.tools }}
|
||||
|
||||
# Outils individuels
|
||||
{{- range $tool := $currentHost.tools }}
|
||||
{{- range $tool := $currentUser.tools }}
|
||||
{{- if kindIs "map" $tool }}
|
||||
{{- range $toolName, $params := $tool }}
|
||||
{{ $toolName }} = { version = "{{ $params.version | default "latest" }}"{{ range $key, $value := omit $params "version" }}, {{ $key }} = "{{ $value }}"{{ end }} }
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
"{{ $tool }}" = "latest"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if $currentHost }}
|
||||
# Aucun profil trouvé dans hosts.yaml pour l'utilisateur {{ $username }} sur la machine : {{ $hostname }}
|
||||
{{- else }}
|
||||
# Aucun profil trouvé dans hosts.yaml pour la machine : {{ $hostname }}
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user