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>
This commit is contained in:
+63
-35
@@ -2,43 +2,71 @@
|
||||
hosts:
|
||||
# PC perso
|
||||
intel-nuc-hades-canyon:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
- dev-languages
|
||||
- ai
|
||||
tools:
|
||||
- vivid
|
||||
- pipx:vit
|
||||
- pipx:speedtest-cli
|
||||
- pipx:asciinema
|
||||
configs: {}
|
||||
users:
|
||||
xavier:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
- dev-languages
|
||||
- ai
|
||||
tools:
|
||||
- vivid
|
||||
- pipx:vit
|
||||
- pipx:speedtest-cli
|
||||
- pipx:asciinema
|
||||
configs: {}
|
||||
root:
|
||||
toolboxes:
|
||||
- terminal
|
||||
tools: []
|
||||
configs: {}
|
||||
# Serveur dédié
|
||||
cloud:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
- dev-languages
|
||||
- ai
|
||||
tools:
|
||||
- pipx:vit
|
||||
configs: {}
|
||||
users:
|
||||
xavier:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
- dev-languages
|
||||
- ai
|
||||
tools:
|
||||
- pipx:vit
|
||||
configs: {}
|
||||
root:
|
||||
toolboxes:
|
||||
- terminal
|
||||
tools: []
|
||||
configs: {}
|
||||
# Container de dev
|
||||
devenv:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
- dev-languages
|
||||
- devops
|
||||
- ai
|
||||
tools:
|
||||
- sops
|
||||
- age
|
||||
- cargo:rage
|
||||
configs: {}
|
||||
users:
|
||||
xavier:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
- dev-languages
|
||||
- devops
|
||||
- ai
|
||||
tools:
|
||||
- sops
|
||||
- age
|
||||
- cargo:rage
|
||||
configs: {}
|
||||
root:
|
||||
toolboxes:
|
||||
- terminal
|
||||
tools: []
|
||||
configs: {}
|
||||
termux-debian:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
tools: {}
|
||||
configs: {}
|
||||
users:
|
||||
xavier:
|
||||
toolboxes:
|
||||
- terminal
|
||||
- dev-tools
|
||||
tools: {}
|
||||
configs: {}
|
||||
root:
|
||||
toolboxes:
|
||||
- terminal
|
||||
tools: []
|
||||
configs: {}
|
||||
|
||||
@@ -3,9 +3,15 @@
|
||||
{{- $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 }}
|
||||
@@ -22,16 +28,18 @@ 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 }}
|
||||
"{{ $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 }}
|
||||
|
||||
Reference in New Issue
Block a user