These are my dotfiles implemented with chezmoi
chezmoi stores the desired state of your dotfiles in the directory
~/.local/share/chezmoi
. When you run chezmoi apply
, chezmoi calculates the
desired contents and permissions for each dotfile and then makes any changes
necessary so that your dotfiles match that state.
Assuming that you have already installed chezmoi, initialize chezmoi with:
$ chezmoi init
This will create a new git local repository in ~/.local/share/chezmoi
where
chezmoi will store its source state. By default, chezmoi only modifies files in
the working copy.
Manage your first file with chezmoi:
$ chezmoi add ~/.bashrc
This will copy ~/.bashrc
to ~/.local/share/chezmoi/dot_bashrc
.
Edit the source state:
$ chezmoi edit ~/.bashrc
This will open ~/.local/share/chezmoi/dot_bashrc
in your $EDITOR
. Make some
changes and save the file.
See what changes chezmoi would make:
$ chezmoi diff
Apply the changes:
$ chezmoi -v apply
All chezmoi commands accept the -v
(verbose) flag to print out exactly what
changes they will make to the file system, and the -n
(dry run) flag to not
make any actual changes. The combination -n
-v
is very useful if you want to
see exactly what changes would be made.
Next, open a shell in the source directory, to commit your changes:
$ chezmoi cd
$ git add .
$ git commit -m "Initial commit"
Create a new repository on GitHub called dotfiles
and then push your repo:
$ git remote add origin [email protected]:username/dotfiles.git
$ git branch -M main
$ git push -u origin main
Other interesting files in this repository:
packages
: list of all packages installed through the classic APT repositoriesflatpacks
: list of all packages installed with Flatpak that I use in my daily basis