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