Multiuser and multiplatform dotfiles using GNU Stow
A new system is bootstrapped by cloning, stowing and activating the dotfiles. Activating involves installing utilities and configuring the shell. To clone, use git and an SSH key for push access.
- Clone repository (requires git).
- Install Homebrew.
- Install utilities using Homebrew.
- Run stow to setup directories.
- Bootstrap other utilities.
# Clone repository
git clone git@github.com:victorandree/dotfiles.git ~/.dotfiles
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install utilities using Homebrew
cd ~/.dotfiles && brew bundle
# Run stow to setup directories
ls -d */ | xargs --no-folding stow
# Bootstrap other utilities
# We prefer having "local" files include configuration, because utilities like to add stuff to these locations
echo 'source "$HOME/.config/zsh/zlogin.zsh"' >~/.zlogin
echo '[include]\n path = ~/.config/git/default' >~/.config/git/config
echo 'source $XDG_CONFIG_HOME/tmux.conf' >~/.tmux.conf
There are a couple of considerations made about configuring shells:
- You probably don't want to "reset" environment in every shell. This means that we don't use
.zshenv
to configure e.g.PATH
, or other environment variables. - macOS runs
path_helper
in/etc/zprofile
.path_helper
will put anything already onPATH
at the end. Therefore, you can't override system utilities in.zshenv
- Install scripts like to mess with
~/.zshrc
. The post-install script of many utilities is to add stuff to yourPATH
. This either happens automatically or as instructions to do so. - Non-interactive login shells are very rare. You'll almost never run a login shell that's non-interactive. This means that
~/.zshrc
isn't very useful.
TL;DR: Create ~/.zlogin
to override global stuff for login shells. This does mean that when running SSH commands, the environment may not have been setup "as expected", but otherwise results in a simple experience.
We add some plugins to zsh using git subtree. These are added with prefix shell/.local/share/zsh
. To update:
git subtree pull --squash --prefix shell/.local/share/zsh/pure https://github.com/sindresorhus/pure.git master
git subtree pull --squash --prefix shell/.local/share/zsh/zsh-syntax-highlighting https://github.com/zsh-users/zsh-syntax-highlighting.git master
vim-packager is used for vim packages. It doesn't seem possible to manage the package manager separately from packages. Therefore, install using the instructions:
git clone https://github.com/kristijanhusak/vim-packager ~/.config/nvim/pack/packager/opt/vim-packager