4 ms·
This is how I manage my dotfiles since I discovered stow a couple of months ago. The only thing that bugs me is that I haven't figured out an elegant way to ha
by LukaD 12y ago
This is how I manage my dotfiles since I discovered stow a couple of months ago.
The only thing that bugs me is that I haven't figured out an elegant way to have some configs include machine specific configs. For example a set of bash aliases that I only use at work but don't want at home.
My best idea is to source all files in, say ~/.bashrc.d and put machine specific configs in there... Haven't tried it out yet.
- anu_gupta 12y agoNot sure if this would work with Stow, but in my .bashrc I just do this: if [ -f ~/config/bashrc_$(hostname -s) ]; then source ~/config/bashrc_$(hostname -s) fi this gives me machine specific configs.
- jackalope 12y agoYou can do something similar to target *nix platforms like Darwin|FreeBSD|Linux|NetBSD|OpenBSD with: if [ -f ~/config/bashrc_$(uname -s) ]; then source ~/config/bashrc_$(uname -s) fi
- LukaD 12y agoGreat idea! It wouldn't work for me though as I tend to call all my machines 'fuckup' (I know...) ;)
- RexRollman 12y agoIn that case, you could have it read or check the existence of something else, like a file in /etc.
- mjcarroll 12y agoI also use stow to manage my common personal dotfiles, as well as my employer-specific dtofiles. The way I do this is to keep my general files in my dotfiles repository, but then keep work specific ones in a separate repo (dotfiles-employer). This separate repo has .private versions of all of my commonly used dotfiles (for example .bashrc.private), and my top-level files will check for the existence and source these, if present. Both repos will be installed using stow, with the work dotfiles generally just extending the personal dotfiles.
- philsnow 12y ago> My best idea is to source all files in, say ~/.bashrc.d and put machine specific configs in there... Haven't tried it out yet. A fair amount of the time when I'm setting up a .foorc, I'll want to add some functions to bashrc, or change a MANPATH or something, so this pattern is useful for that too; you could just have a ~/dotfiles/.bashrc.d/foo.sh and have your .bashrc unconditionally source everything in ~/.bashrc.d/. Then when you use stow to setup foo, its bashrc modifications get installed too.