feat(mise): Automate ~/.config/mise/config.toml generation based on yaml data and some logic

This commit is contained in:
2026-07-15 15:40:17 +02:00
parent ba28af01ed
commit ef95b6f198
6 changed files with 197 additions and 97 deletions
+38
View File
@@ -0,0 +1,38 @@
---
hosts:
# PC perso
intel-nuc-hades-canyon:
toolboxes:
- terminal
- dev-tools
- dev-languages
- ai
tools:
- vivid
- pipx:vit
- pipx:speedtest-cli
- pipx:asciinema
configs: {}
# Serveur dédié
cloud:
toolboxes:
- terminal
- dev-tools
- dev-languages
- ai
tools:
- pipx:vit
configs: {}
# Container de dev
devenv:
toolboxes:
- terminal
- dev-tools
- dev-languages
- devops
- ai
tools:
- sops
- age
- cargo:rage
configs: {}
+23
View File
@@ -0,0 +1,23 @@
---
packages:
ubuntu:
common:
- tar
- zip
- unzip
- manpages
- manpages-fr
- bash
- bash-completion
- screen
- tmux
- curl
- wget
- vim
- git
- tree
- build-essential
server: []
desktop:
- zsh
- fish
+62
View File
@@ -0,0 +1,62 @@
---
tools:
toolboxes:
terminal:
- powerline-go
- lsd
- bat
- ripgrep
- fd
- gdu
- bottom
- dust
- fzf
- zoxide
- broot
- glow
dev-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' }
- jq
- yq
- shellcheck
dev-languages:
- python
- uv
- pipx
- node
- go
- rust
- cargo-binstall
devops:
- docker-cli
- kubectl
- krew
- k9s
- helm
- flux2
- kind
- crane
- dive
- trivy
- podman
- minikube
- kwok
- cosign
- lazydocker
ai:
- claude
- gemini-cli
- codex
# # Password managers
# # vault = "latest"
# sops = "latest"
# age = "latest"
# # "cargo:rage" = "latest"
#
# # Desktop tools
# #obsidian = { version = "latest", asset_pattern = "Obsidian-{version}.AppImage" }
+33
View File
@@ -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 }}
+36
View File
@@ -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 }}
+5 -97
View File
@@ -7,33 +7,7 @@ binstall = true
######################### [ Bootstrap ] #########################
[bootstrap.packages]
"apt:tar" = "latest"
"apt:zip" = "latest"
"apt:unzip" = "latest"
"apt:manpages" = "latest"
"apt:manpages-fr" = "latest"
"apt:bash" = "latest"
"apt:bash-completion" = "latest"
"apt:zsh" = "latest"
"apt:fish" = "latest"
"apt:screen" = "latest"
"apt:tmux" = "latest"
"apt:curl" = "latest"
"apt:wget" = "latest"
"apt:vim" = "latest"
"apt:git" = "latest"
"apt:tree" = "latest"
{{ if (and (eq .chezmoi.os "linux") (eq .chezmoi.osRelease.name "Ubuntu")) }}
"apt:build-essential" = "latest"
{{ end }}
{{ template "mise-bootstrap-packages" . }}
# coreutils grep less
# tig
@@ -55,44 +29,12 @@ usage = "latest"
# Configuration
chezmoi = "latest"
# Terminal
# kitty = { version = "latest", asset_pattern = "kitty-*-x86_64.txz" }
# Editor
neovim = "latest"
tree-sitter = "latest"
# Languages
# -- python --
python = "latest"
uv = "latest"
pipx = "latest"
# -- node --
node = "latest"
# -- go --
go = "latest"
# -- rust --
rust = "latest"
cargo-binstall = "latest"
# Terminal tools
powerline-go = "latest"
lsd = "latest"
bat = "latest"
ripgrep = "latest"
fd = "latest"
gdu = "latest"
bottom = "latest"
dust = "latest"
fzf = "latest"
zoxide = "latest"
broot = "latest"
glow = "latest"
# Tools automated with chezmoi
{{ template "mise-tools" . }}
# Password managers
# vault = "latest"
@@ -100,42 +42,8 @@ sops = "latest"
age = "latest"
# "cargo:rage" = "latest"
# Dev toolbox
lazygit = "latest"
delta = "latest"
gh = "latest"
tea = { version = "0.14.2", url = 'https://gitea.com/gitea/tea/releases/download/v{{- "{{" }} version {{ "}}" -}}/tea-{{- "{{" }} version {{ "}}" -}}-{{- "{{" }} os() {{ "}}" -}}-{{- "{{" }} arch(x64="amd64") {{ "}}" -}}.xz' }
jq = "latest"
yq = "latest"
# DevOps toolbox
# docker-cli = "latest"
# kubectl = "latest"
# krew = "latest"
# k9s = "latest"
# helm = "latest"
# flux2 = "2.3.0"
# kind = "latest"
# crane = "latest"
# dive = "latest"
# trivy = "latest"
# podman = "latest"
# minikube = "latest"
# kwok = "latest"
# cosign = "latest"
# lazydocker = "latest"
# AI tools
# gemini-cli = "latest"
# claude = "latest"
# codex = "latest"
# Terminal
# kitty = { version = "latest", asset_pattern = "kitty-*-x86_64.txz" }
# Desktop tools
#obsidian = { version = "latest", asset_pattern = "Obsidian-{version}.AppImage" }
shellcheck = "latest"
vivid = "latest"
"pipx:vit" = "latest"
"pipx:speedtest-cli" = "latest"
# "pipx:asciinema" = "latest"