feat(mise): Automate ~/.config/mise/config.toml generation based on yaml data and some logic
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
{{/* .chezmoitemplates/mise-bootstrap-packages */}}
|
||||
{{- $isUbuntu := false -}}
|
||||
{{- $isUbuntuServer := false -}}
|
||||
{{- $isUbuntuDesktop := false -}}
|
||||
{{- if and (eq .chezmoi.os "linux") (hasKey .chezmoi "osRelease") (eq .chezmoi.osRelease.id "ubuntu") -}}
|
||||
{{- $isUbuntu = true -}}
|
||||
{{- if stat "/usr/bin/gnome-shell" }}
|
||||
{{- $isUbuntuDesktop = true -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $isUbuntu }}
|
||||
|
||||
# Ubuntu common
|
||||
{{- range .packages.ubuntu.common }}
|
||||
"apt:{{- . }}" = "latest"
|
||||
{{- end }}
|
||||
|
||||
{{- if $isUbuntuServer }}
|
||||
# Ubuntu server
|
||||
{{- range .packages.ubuntu.server }}
|
||||
"apt:{{- . }}" = "latest"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $isUbuntuDesktop }}
|
||||
# Ubuntu desktop
|
||||
{{- range .packages.ubuntu.desktop }}
|
||||
"apt:{{- . }}" = "latest"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{/* .chezmoitemplates/mise-tools */}}
|
||||
{{- $hostname := .chezmoi.hostname -}}
|
||||
{{- $currentHost := index .hosts $hostname -}}
|
||||
|
||||
{{- if $currentHost }}
|
||||
{{- /* 1. Parcourir les toolboxes associées à cet hôte */}}
|
||||
{{- range $toolboxName := $currentHost.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:' du host) */}}
|
||||
{{- if hasKey $currentHost "tools" }}
|
||||
{{- if $currentHost.tools }}
|
||||
|
||||
# Outils individuels
|
||||
{{- range $tool := $currentHost.tools }}
|
||||
{{ $tool }} = "latest"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
# Aucun profil trouvé dans hosts.yaml pour la machine : {{ $hostname }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user