News for hackers. Stuff that matters.
Re:Chezmoi: manage your dotfiles securely across multiple ma... by RagingCactus on Monday January 14, 2019 @10:05AM (#18903453)
Is there a way to manage different "categories" of systems with chezmoi? For example, a "linux-server" category would contain an essential set of dotfiles, but not all the window manager related stuff from my linux laptop. Looking at the documentation, the only way to do this would be hostname-based templating, but that seems cumbersome as you would have to change every single template to add the new hostname to the section in question.
Re:Chezmoi: manage your dotfiles securely across multiple ma... by twp on Monday January 14, 2019 @10:13AM (#18903515)
Yes, you can define your own template variables in the config file, for example if you include:

  data:
    category: "linux-server"
in your .config/chezmoi/chezmoi.yaml file, you can then use it in your templates and a .chezmoiignore file (which is also treated as a template). A .chezmoiignore file could look like:

  {{ if eq .category "linux-server" -}}
  .windowmanager.conf
  {{ end -}}
I use this technique myself: https://github.com/twpayne/dotfiles/blob/master/.chezmoiigno...
Re:Chezmoi: manage your dotfiles securely across multiple ma... by RagingCactus on Monday January 14, 2019 @10:24AM (#18903616)
Thanks! Just defining it as a config variable is far too obvious in hindsight, I don't know why it didn't cross my mind.

I'll definitely try it out!