Need advice/confirmation migrating from homesick/castles #4592
-
Dear community, I am considering switching to chezmoi from a patched version of homes(h)ick. I have 4 repositories each with a bootstrap script that installs packages etc. I want to be able to install packages and config files starting with a simple "core" configuration, which sets up the shell, some environment variables, terminfo entries and such. The next level is tmux and configuration/plugins, then neovim with all configs/plugins and then a coding environment with multiple languages. I do not mind having all in one repository, they all install in the same $HOME destination, no overlaps. I would like to see in a bare minimum installation, that only minimal packages are installed and the home directory is having only the minimum config files from core, e.g. My current idea would be to have four source directories like:
The I would edit a local not-checked-in "roles" file listing all the groups I need on a machine. There would also be a run_onchange script, that installs the packages based on the contents of the "roles" file. My set of config files do not need any templates, the bootstrapping scripts automatically determine already the OS/architecures and package managers and are idempotent. Does that seem like a valid approach to my goals? I would like to get some feedback from the experienced users here. Thanks for your thoughts... Michael. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
What you're suggesting is far outside of what chezmoi does and would require that you maintain multiple state files as well as chezmoi is not reentrant, by design. With judicious use of templates, you can achieve role-based and even layered configuration. Alternatively, there's a discussion about layered configuration — I'm on my phone, so I can't get to it easily — but it requires separate commands to manage (but they can be chained in shell scripts). |
Beta Was this translation helpful? Give feedback.
-
I would approach this differently. Use a boolean variables for each role, which you initialize with a config file template, and then use these variables in your dotfiles and |
Beta Was this translation helpful? Give feedback.
-
Thank you all for your advice and suggestions! I gave up my original approach and went with an array of roles and
and the ignore file has now sections for the roles like:
It was cleaner to do it that way and I get some features, that I haven't had in homesick, which I might use later. Thanks again, for the helpful responses! Michael. |
Beta Was this translation helpful? Give feedback.
-
Hm, I am running into trouble with the scripts: Why is this simple script run every time, even if the repo did not change at all?
Hm, it seems, that it is because of the exit code... Should that not be mentioned in the documentation, that an unsuccessful exit code will lead to the script being executed every time? Michael. |
Beta Was this translation helpful? Give feedback.
-
Honestly, guys, this thing is nice! After working with it for two evenings, I quite like the design and functions. Very well designed... |
Beta Was this translation helpful? Give feedback.
-
@twpayne thanks again for the support and the tool. I was able to convert my old solution to chezmoi in a single day. It feels cleaner, installs quickly and I can now select any role individually or together with other roles and all installations are going well. The result is now here, although you have by now obviously seen enough of people's hacks...: Have a good weekend, Michael. |
Beta Was this translation helpful? Give feedback.
I would approach this differently.
Use a boolean variables for each role, which you initialize with a config file template, and then use these variables in your dotfiles and
.chezmoiignore
to decide what to include.