twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
12.85k stars 477 forks source link

interpreter config lost in chezmoi.yaml on windows #2490

Closed CrystalMethod closed 1 year ago

CrystalMethod commented 1 year ago

Describe the bug

I need to define an interpreter to get my shellscripts (.sh.tmpl) executed on Windows.

on Windows

.local/share/chezmoi/.chezmoi.yaml.tmpl

...
interpreters:
  sh:
    command: bash
...

after running chezmoi init

.config/chezmoi/chezmoi.yaml

...
<the interpreters path has been removed .. all other settings have been applied>
...

and when running chezmoi apply the shellscripts result in error "..is not a valid Win32 application". As soon as I re-add these settings to chezmoi.yaml the scripts will be executed.

on Linux/WSL

.local/share/chezmoi/.chezmoi.yaml.tmpl

...
interpreters:
  sh:
    command: bash
...

after running chezmoi init

.config/chezmoi/chezmoi.yaml

...
interpreters:
  sh:
    command: bash
...

the settings have been applied.

I'm somewhat lost. Did I miss something?

twpayne commented 1 year ago

I don't see an interpreters section in your config file template. Is it possible that your config file is being overwritten when you run chezmoi init?

Also, please do complete the bug report template completely when reporting a bug. Information like the output of chezmoi doctor and the output of the command with the --verbose flag helps everyone find the solution to your problem faster.

CrystalMethod commented 1 year ago

I apologize for disturbing you about this. The cause of my described problem was quite simple: I moved the dotfiles git repo to another location over time. but sourceDir still pointed to the old location. There the new settings for interpreters did not exist, which made it feel like my settings were lost. Correcting sourceDir thus solved the problem and the interpreters settings are applied correctly. Thank you!

twpayne commented 1 year ago

Great! Glad that you found the solution :)