5 ms·
My main gripe with dotfile managers (including lnk) is that they assume a uniform environment. I haven't found one that doesn't make this fundamendal assumption
by m000 1y ago
My main gripe with dotfile managers (including lnk) is that they assume a uniform environment. I haven't found one that doesn't make this fundamendal assumption.
Some scenarios where dot fils may differ between computers:
- My .gitconfig is different on my work laptop than my desktop.
- I don't have neovim installed on my pi zero running DNS for my home network.
- My zsh functions for making animated gifs won't work if specific tools are not installed.
- An alias to open an image with the default image viewer is different between macos and linux.
- I only have rust toolchain installed on my home desktop, so I shouldn't see it in my PATH on my work laptop.
Is there any solution out there that can handle similar cases? Or are these requirements unique to me? (I don't quite believe they are.)
- Galanwe 1y agoI believe most dotfile managers offer the possibility to switch config based on hosts (e.g. chez-moi has templates https://www.chezmoi.io/user-guide/manage-machine-to-machine-differences/ https://www.chezmoi.io/user-guide/manage-machine-to-machine-... ). I guess with lnk being git centric that would be through branches. In any case you can manage your bashrc/profile and handle conditional logic to install packages there.
- yonatan8070 1y agoFor shell stuff, I use fish, and my fish config has a bunch of if...end blocks around most things, for example: ```if command -q exa alias ls="exa" alias ll="exa -lah" alias tree="exa --tree" end if command -q eza alias ls="eza" alias ll="eza -lah" alias tree="eza --tree" end```
- hk1337 1y agoFish seems to keep it contained to .config/fish which is nice. Most others tend to spread out outside of .config I’ve started modeling fish with zsh and OMZ customs
- setopt 1y agoThis plugin simplifies that workflow: https://github.com/jabirali/fish-abbrfile https://github.com/jabirali/fish-abbrfile
- yonatan8070 1y agoThat's pretty neat, thanks!
- deleted 1y ago[deleted]
- philjackson 1y agoCheck out YADM which allows you to link files based on criteria such as hostname.
- snapplebobapple 1y agoThis is my answer too. I extract the stuff that is unique from my config files to files sourced by my configs and then make it unique by hostname with yadm. It works so well
- justusthane 1y agoI handled this by just writing a simple install script that symlinks different files depending the OS (but could use any criteria—hostname, installed packages, etc). Updating the dot files is just a matter of a git pull. If I’ve added a new dotfile, then I run the install script again.
- danlitt 1y agoIt is significantly more complicated, but what about a symlink manager driven by a programming language, such as guix home or nix's home-manager?
- SuperCuber 1y agoCheck out https://github.com/SuperCuber/dotter https://github.com/SuperCuber/dotter
- ljm 1y agoGit supports conditional configuration so you can tell it to load different config files based on file system location or what have you. I use it to swap signing keys and author info depending on whether the repo is personal or for work based.
- alsetmusic 1y agoI solve this locally by having a bash_profile that is universal and then OS-specific files that get loaded by a function that checks the OS. It’s slightly more to manage, but works perfectly. Completely compatible with any dotfiles management tool I’ve encountered. No reason this couldn’t be expanded to factor additional variables.