Closed grasegger closed 1 year ago
@grasegger - Is using a symbolic link a possibility?
@TheLocehiliosan But how would I make sure the tracked symlink only gets created on darwin systems?
$HOME/.config/yadm/src/abc
.ln -s "$HOME/.config/yadm/src/abc" "$HOME/Library/Preferenes/abc"
mv "$HOME/Library/Preferenes/abc" "$HOME/.config/yadm/alt/Library/Preferenes/abc##os.Darwin"
yadm add "$HOME/.config/yadm/alt/Library/Preferenes/abc##os.Darwin"
ln -s "$HOME/.config/yadm/src/abc" "$HOME/.config/abc/abc.conf"
mv "$HOME/.config/abc/abc.conf" "$HOME/.config/yadm/alt/.config/abc/abc.conf##os.Linux"
yadm add "$HOME/.config/yadm/alt/.config/abc/abc.conf##os.Linux"
I know this sounds a bit complicated, but the end result would look like this:
.config/yadm/alt/Library/Preferenes/abc##os.Darwin -> $HOME/.config/yadm/src/abc .config/yadm/alt/.config/abc/abc.conf##os.Linux -> $HOME/.config/yadm/src/abc .config/yadm/src/abc
Note: it's important to use fully qualitified symlinks on each system, because your different systems may very well have different $HOME paths.
- Choose a central place you want the file to exist. For my example, I'll use
$HOME/.config/yadm/src/abc
.- This file should be added to your dotfiles repo.
- On the system where you want this file referenced by an system specific path do the following:
- Create a "fully qualitified" symlink to the file from step 1, in the desired location.
ln -s "$HOME/.config/yadm/src/abc" "$HOME/Library/Preferenes/abc"
- Move that new symlink under the .config/yadm/alt path, and name it using a template that will match the system. https://yadm.io/docs/alternates#
mv "$HOME/Library/Preferenes/abc" "$HOME/.config/yadm/alt/Library/Preferenes/abc##os.Darwin"
- Add that symlink to your dotfiles repo
yadm add "$HOME/.config/yadm/alt/Library/Preferenes/abc##os.Darwin"
- At this point, yadm should have created a symlink in your desired path, which points to the os.Darwin versions (which in turn points to the central version)
- Repeat this on the other system
ln -s "$HOME/.config/yadm/src/abc" "$HOME/.config/abc/abc.conf"
mv "$HOME/.config/abc/abc.conf" "$HOME/.config/yadm/alt/.config/abc/abc.conf##os.Linux"
yadm add "$HOME/.config/yadm/alt/.config/abc/abc.conf##os.Linux"
- The appropriate symlink will only be created on the systems that match the template you use.
I know this sounds a bit complicated, but the end result would look like this:
.config/yadm/alt/Library/Preferenes/abc##os.Darwin -> $HOME/.config/yadm/src/abc .config/yadm/alt/.config/abc/abc.conf##os.Linux -> $HOME/.config/yadm/src/abc .config/yadm/src/abc
Note: it's important to use fully qualitified symlinks on each system, because your different systems may very well have different $HOME paths.
This is brilliant, I kinda forgot about tracking a symlink with git and wouldn't have thought that yadm just treats them like files.
This question is about
Describe your question
Some tools (like aerc) put their macos configs in ~/Library/Preferenes instead of the .config dir they use on linux. How would I best go about using the same config file both on darwin and linux?
When searching for this issue I found a help page by chezmoi explaining exactly what I wanna achive, but I'd rather not switch my dotfile manager ... :D https://www.chezmoi.io/user-guide/manage-machine-to-machine-differences/#handle-different-file-locations-on-different-systems-with-the-same-contents