-
I use chezmoi externals to install tools like starship. In my dot_bashprofile.tmpl, I use a conditional like this:
The issue that I'm facing is that chezmoi evaluates the template before starship is downloaded, so the condition fail. At least I think that's the cause. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
According to https://www.chezmoi.io/reference/application-order/, externals are processed along with other managed files in alphabetical order of their target name. So that means to me that externals won't be available until they are processed. Since your logic happens in a file that is processed during the same apply step, you will likely have to apply again afterwards. In my experience (I'm no expert), I've found that I have to do chezmoi apply multiple times based on the context at any given time. You might have to live with multiple apply calls given your situation. |
Beta Was this translation helpful? Give feedback.
-
Another option is to use the same logic that decides whether to install the starship external in your |
Beta Was this translation helpful? Give feedback.
Another option is to use the same logic that decides whether to install the starship external in your
dot_bashprofile.tmpl
instead of usingfindExecutable
/lookPath
. For example, if you always install starship then you can unconditionally always include# Some logic using starship
. This way, the order of application doesn't matter and your dotfiles are more robust and declarative.