Replies: 2 comments 3 replies
-
Oh, as a side note — the docs aren't super clear on what environment variables a plugin will see. Are they the same as for hooks and scripts? Is there a way to get the source and target directory without hard-coding? |
Beta Was this translation helpful? Give feedback.
-
chezmoi ignores all files that begin with a
To see what environment variables are set, the easiest way is to run: $ chezmoi cd
$ set | grep ^CHEZMOI_ You can get the source directory with the However, do you really need a dconf plugin for all of this? I use a |
Beta Was this translation helpful? Give feedback.
-
I was contemplating writing a more structured dconf plugin based on the notes/examples around the place. One speedbump I've hit is how exactly to store the data.
If I store it in the source dir, chezmoi will try to populate it in the user's directory. So if I do eg.
$SRC_DIR/dot_dconf-plugin
, the user ends up with~/.dconf-plugin
. But I don't want this, the point is the store the data and then load it with thedconf
command line utility. It doesn't need to go through some intermediate filesystem tree.One workaround is to simply accept this and have my plugin use files in eg.
~/.config/dconf-plugin
. But then a plugin is not really solving anything. A user can already rundconf load
on stuff stored in chezmoi. I'd basically be writing a non-chezmoi application that reads data from yet another config dir. The real problem I want to solve is managing the gap betweendconf dump
output and chezmoi's structured storage.What I would (tentatively) suggest is a new source state attribute,
plugin_
, where chezmoi does not populate targets based on such a directory, and does not (by default) overwrite them onadd
.There may be other useful features you could do with this, eg. a special
.chezmoiplugin
file containing a plugin name, so that chezmoi commands are passed through to the plugin (chezmoi apply
invokeschezmoi pluginname apply <temp path to post-template-rendering source subtree>
or somesuch). But primarily, having a way to store data without applying directly would be good. I haven't been using chezmoi for that long, so maybe there's a way to do this with the existing features I haven't seen yet.Beta Was this translation helpful? Give feedback.
All reactions