#!/bin/bash set -e un="$(uname)" case "${un}" in Linux) ostype=linux homebrew_prefix_default=/home/linuxbrew/.linuxbrew ;; Darwin) ostype=macos if [[ "$(uname -m)" == "arm64" ]] then homebrew_prefix_default=/opt/homebrew else homebrew_prefix_default=/usr/local fi esac # Install homebrew if it doesn't exist if [[ ! -d "${homebrew_prefix_default}" ]] then CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi if [ -n $CODESPACES ] then # Codespaces has a .gitconfig already setup, but in order to take advantage of # the attributes set in /etc/gitconfig we have to explicitly include the path. git config --global include.path /etc/gitconfig dotfiles_dir="$(pwd -P)" # Symlink all of the dotfiles to the $HOME directory for dotfile in .*; do # Skip . and .. directories echo $dotfile | egrep -q '^(\.+)$' && continue source="$dotfiles_dir/$dotfile" destination="$HOME/$dotfile" # If the directory already exists in the $HOME directory then we'll # just symlink the contents rather than the directory itself. # Basically this is just ~/.config if [ -d $destination ] && ! [ -L $destination ] then for file in $source/* do ln -sfv "$file" "$destination" done continue fi [ -d $dotfile ] && dotfile="$dotfile/" if [ -L $destination ] && [ -d $dotfile ] then ln -sfv "$source" "$destination" else rm -rv "$destination" 2>/dev/null ln -sv "$source" "$destination" fi done # Bring in all of our submodule dependencies git submodule update --recursive --init elif [ ! -d $HOME/.dotfiles ] then # https://www.atlassian.com/git/tutorials/dotfiles git clone --bare https://github.com/tarebyte/dotfiles.git $HOME/.dotfiles function dconfig { /usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@ } dconfig checkout dconfig status.showUntrackedFiles no # Bring in all of our submodule dependencies dconfig submodule update --recursive --init fi alias brew="$homebrew_prefix_default/bin/brew" brew bundle --file $HOME/.homebrew/Brewfile if [ "${ostype}" == macos ] then brew bundle --file $HOME/.homebrew/Brewfile.darwin fi homebrew_fish_path="${homebrew_prefix_default}/bin/fish" alias fish=$homebrew_fish_path echo $homebrew_fish_path | sudo tee -a /etc/shells chsh -s $homebrew_fish_path # Install fisher plugins echo "curl -sL https://git.io/fisher | source && fisher update" | fish # Set the theme echo "base16-ocean" | fish # Install Neovim packages via packer echo "nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'" | fish echo "All set!"