Manage dotfiles with chezmoi | |
2024-03-10 | |
Last edit: 2024-03-10 | |
--------------------- | |
To give a bit of context, I had automated the deployment of the configuration o… | |
repository | |
). This setup is compatible with almost all Linux distributions (probably UNIX … | |
I found by chance | |
chezmoi | |
which is able to manage dotfiles as well as some other configurations which co… | |
Some people pair it with Ansible but I prefer to use the solution in a very sim… | |
Something interesting about | |
chezmoi | |
is that it supports file encryption with modern tools like [age](https://age-e… | |
My configuration template looks like this (below) in the `.chezmoi.yaml.tmpl` f… | |
{% raw %} | |
```jinja2 | |
{{ $has_age := false }} | |
{{ $sudo := "sudo" }} | |
{{ $font := "Comic Code" }} | |
{{ if stdinIsATTY }} | |
{{ $has_age = promptBool "do you have age " }} | |
{{- $sudo_choices := list "sudo" "doas" -}} | |
{{- $sudo = promptChoiceOnce . "choice" "choose" $sudo_choices -}} | |
{{ $font = promptString "font name " }} | |
{{ end }} | |
{{ if $has_age }} | |
encryption: "age" | |
age: | |
identity: "/home/nagi/.config/age/key.txt" | |
recipient: "age14m06fd3svs9neg2w97ccw3c8470hckl95qxr6jw8fgm4ex65352q6tun06" | |
{{ end }} | |
data: | |
sudo: {{ $sudo }} | |
font: {{ $font }} | |
``` | |
{% endraw %} | |
For the moment the repository is only compatible with Fedora and Arch Linux, ho… | |
## Apply from a different machine | |
To apply my configuration from another machine, simply run the following comman… | |
```bash | |
chezmoi init https://github.com/theobori/dotfiles.git | |
chezmoi apply -v | |
``` | |
## Links | |
https://github.com/theobori/dotfiles | |