Files
config-chezmoi/.chezmoitemplates/mise-tools
T
xavierandClaude Sonnet 5 bbda4fdbcb feat(mise): Add per-user toolsets to hosts.yaml
Nest each host's toolboxes/tools/configs under users.<username> so
root and xavier can have different tool selections on the same
machine, instead of sharing one profile per host.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 22:09:18 +02:00

46 lines
1.7 KiB
Plaintext

{{/* .chezmoitemplates/mise-tools */}}
{{- $hostname := output "hostname" | trim -}}
{{- $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 := $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" }
{{- else }}
"{{ $tool }}" = "latest"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- /* 2. Parcourir les outils individuels (la liste 'tools:' de l'utilisateur) */}}
{{- if hasKey $currentUser "tools" }}
{{- if $currentUser.tools }}
# Outils individuels
{{- range $tool := $currentUser.tools }}
"{{ $tool }}" = "latest"
{{- 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 }}