Closed reputet closed 3 years ago
Short (wrong) answer: chezmoi apply
takes a list of targets, so you can run
chezmoi apply ~/.bashrc ~/.htoprc ~/.vimrc
on workstation and
chezmoi apply ~/.vimrc ~/.vlc/vlcrc ~/.zshrc
on your home PC. But this isn't the right answer.
Long (correct) answer: with chezmoi the idea is that you can run chezmoi apply
on different machines and get the right set of dotfiles for the machine you're running on. Instead of profiles, chezmoi uses templates and files like .chezmoiignore
to ensure that the right set of dotfiles get installed on each machine.
In the specific case you give, I would recommend creating a template variable called workstation
(for example) that you set in your config file and then use in .chezmoiignore
and in your dotfile templates. #957 is relevant.
Thank you very much for the very clear description of the problem - much appreciated!
Tom, thanks so much for your instant and detailed reply!
Template approach is not as straightforward as the configuration one in the example I gave, but I got the idea looking at your .chezmoiignore. It's clear now 👍
Hi, thanks for developing and maintaining such an outstanding tool!
Is your feature request related to a problem? Please describe.
I'm trying to apply only a subset of managed dotfiles, not all of them. And I'm looking for an option to define these sets beforehand so that they can be used later while applying with a single command.
Let' say there is a following list of dotfiles:
And I have two machines: a home PC and a workstation.
My goal is to apply only a few of these files on a particular machine. E.g. I want
.bashrc
,.htoprc
and.vimrc
to be applied on workstation and only.vimrc
,.vlc/vlcrc
and.zshrc
on my home PC.Describe the solution you'd like
From my perspective, it might look like
to add the abovementioned files (
.bashrc
,.htoprc
and.vimrc
) to the home directory on the workstation.Describe alternatives you've considered
I believe here is an example of how a similar feature is implemented in another dotfiles manager as a concept of profiles. It keeps a
config.yaml
file with defined profiles:And you're allowed to choose which profile you want to deploy the files from: