generated from arpitbatra123/eleventy-blog-mnml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed FOSS post for the moment
- Loading branch information
Showing
13 changed files
with
177 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Manage dotfiles with chezmoi | ||
date: "2024-03-10" | ||
--- | ||
|
||
To give a bit of context, I had automated the deployment of the configuration of my Linux environment with an Ansible playbook ([repository](https://github.com/theobori/self-config)). This setup is compatible with almost all Linux distributions (probably UNIX too) but I was looking for something lighter and simpler. | ||
|
||
| ||
|
||
I found by chance [chezmoi](https://chezmoi.io) which is able to manage dotfiles as well as some other configurations which could be linked to these dotfiles. The tool allows you to update files on several different machines, it's very complete, simple and effective. | ||
|
||
Some people pair it with Ansible but I prefer to use the solution in a very simple way, with the tool's native features (scripting and templating). | ||
|
||
| ||
|
||
Something interesting about [chezmoi](https://chezmoi.io) is that it supports file encryption with modern tools like [age](https://age-encryption.org). This is very useful for certain sensitive data such as SSH private keys. So you can add configuration so that the tool can encrypt and decrypt. | ||
|
||
My configuration template looks like this (below) in the `.chezmoi.yaml.tmpl` file. | ||
|
||
| ||
|
||
{% raw %} | ||
```jinja2 | ||
{{ $has_age := false }} | ||
{{ if stdinIsATTY }} | ||
{{ $has_age = promptBool "do you have age " }} | ||
{{ end }} | ||
encryption: "age" | ||
{{ if $has_age }} | ||
age: | ||
identity: "/home/nagi/.config/age/key.txt" | ||
recipient: "age14m06fd3svs9neg2w97ccw3c8470hckl95qxr6jw8fgm4ex65352q6tun06" | ||
{{ end }} | ||
``` | ||
{% endraw %} | ||
| ||
|
||
For the moment the repository is only compatible with Fedora only, however it is easy to implement other distributions. | ||
|
||
## Apply from a different machine | ||
| ||
|
||
To apply my configuration from another machine, simply run the following commands. | ||
|
||
```bash | ||
chezmoi init https://github.com/theobori/dotfiles.git | ||
chezmoi apply -v | ||
``` | ||
|
||
## Links | ||
|
||
[https://github.com/theobori/dotfiles](https://github.com/theobori/dotfiles) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Manage dotfiles with chezmoi | ||
## 2024-03-10 | ||
To give a bit of context, I had automated the deployment of the configuration of my Linux environment with an Ansible playbook ( | ||
=> https://github.com/theobori/self-config repository | ||
). This setup is compatible with almost all Linux distributions (probably UNIX too) but I was looking for something lighter and simpler. | ||
|
||
I found by chance | ||
=> https://chezmoi.io chezmoi | ||
which is able to manage dotfiles as well as some other configurations which could be linked to these dotfiles. The tool allows you to update files on several different machines, it's very complete, simple and effective. | ||
|
||
Some people pair it with Ansible but I prefer to use the solution in a very simple way, with the tool's native features (scripting and templating). | ||
|
||
Something interesting about | ||
=> https://chezmoi.io chezmoi | ||
is that it supports file encryption with modern tools like | ||
=> https://age-encryption.org age | ||
. This is very useful for certain sensitive data such as SSH private keys. So you can add configuration so that the tool can encrypt and decrypt. | ||
|
||
My configuration template looks like this (below) in the .chezmoi.yaml.tmpl file. | ||
|
||
{% raw %} | ||
|
||
```jinja2 | ||
{{ $has_age := false }} | ||
|
||
{{ if stdinIsATTY }} | ||
{{ $has_age = promptBool "do you have age " }} | ||
{{ end }} | ||
|
||
encryption: "age" | ||
{{ if $has_age }} | ||
age: | ||
identity: "/home/nagi/.config/age/key.txt" | ||
recipient: "age14m06fd3svs9neg2w97ccw3c8470hckl95qxr6jw8fgm4ex65352q6tun06" | ||
{{ end }} | ||
``` | ||
|
||
{% endraw %} | ||
|
||
For the moment the repository is only compatible with Fedora only, however it is easy to implement other distributions. | ||
|
||
## Apply from a different machine | ||
|
||
To apply my configuration from another machine, simply run the following commands. | ||
|
||
```bash | ||
chezmoi init https://github.com/theobori/dotfiles.git | ||
chezmoi apply -v | ||
``` | ||
|
||
## Links | ||
|
||
=> https://github.com/theobori/dotfiles https://github.com/theobori/dotfiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 of my Linux environment with an Ansible playbook ( | ||
[h|repository|URL:https://github.com/theobori/self-config|tilde.pink|70] | ||
). This setup is compatible with almost all Linux distributions (probably UNIX too) but I was looking for something lighter and simpler. | ||
|
||
I found by chance | ||
[h|chezmoi|URL:https://chezmoi.io|tilde.pink|70] | ||
which is able to manage dotfiles as well as some other configurations which could be linked to these dotfiles. The tool allows you to update files on several different machines, it's very complete, simple and effective. | ||
|
||
Some people pair it with Ansible but I prefer to use the solution in a very simple way, with the tool's native features (scripting and templating). | ||
|
||
Something interesting about | ||
[h|chezmoi|URL:https://chezmoi.io|tilde.pink|70] | ||
is that it supports file encryption with modern tools like [age](https://age-encryption.org). This is very useful for certain sensitive data such as SSH private keys. So you can add configuration so that the tool can encrypt and decrypt. | ||
|
||
My configuration template looks like this (below) in the `.chezmoi.yaml.tmpl` file. | ||
|
||
For the moment the repository is only compatible with Fedora only, however it is easy to implement other distributions. | ||
|
||
## Apply from a different machine | ||
|
||
To apply my configuration from another machine, simply run the following commands. | ||
|
||
```bash | ||
chezmoi init https://github.com/theobori/dotfiles.git | ||
chezmoi apply -v | ||
``` | ||
|
||
## Links | ||
|
||
[h|https://github.com/theobori/dotfiles|URL:https://github.com/theobori/dotfiles|tilde.pink|70] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters