-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
499c5fd
commit bef7a73
Showing
4 changed files
with
628 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
#!/usr/bin/env sh | ||
|
||
echo "Mac OS Install Setup Script" | ||
|
||
sudo -v | ||
while true; do | ||
sudo -n true | ||
sleep 60 | ||
kill -0 "$$" || exit | ||
done 2>/dev/null & | ||
|
||
unless ENV["CI"] | ||
echo "Installing xcode..." | ||
xcode-select --install | ||
end | ||
|
||
# | ||
# Homebrew | ||
# | ||
# This installs some of the common dependencies needed (or at least desired) | ||
# using Homebrew. | ||
|
||
# Check for Homebrew | ||
if test ! "$(which brew)"; then | ||
echo " Installing Homebrew for you." | ||
distro=$(uname) | ||
# Install the correct homebrew for each OS type | ||
if test "${distro}" = "Darwin"; then | ||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | ||
else | ||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)" | ||
fi | ||
|
||
fi | ||
|
||
brew upgrade | ||
brew update | ||
|
||
echo "Installing recipes from brew..." | ||
|
||
brew install adr-tools | ||
brew install ag | ||
brew install awscli | ||
brew install coreutils | ||
brew install curl | ||
# https://direnv.net | ||
brew install direnv | ||
brew install eza | ||
brew install fd | ||
brew install fzf | ||
brew install gdu | ||
brew install gh | ||
brew install git | ||
brew install git-delta | ||
brew install gnu-sed | ||
brew install gum | ||
brew install jq | ||
brew install libpq | ||
brew link --force libpq | ||
brew install yq | ||
|
||
brew install remotemobprogramming/brew/mob | ||
brew tap neovim/neovim | ||
brew install lpeg && brew install neovim --HEAD | ||
brew install fzf | ||
|
||
brew install ripgrep | ||
brew install joshmedeski/sesh/sesh | ||
brew install pulumi/tap/pulumi | ||
brew install ssh-copy-id | ||
brew install starship | ||
brew install stow | ||
brew install trash | ||
brew install yabai | ||
brew install zoxide | ||
|
||
if test ! ENV["CI"]; then | ||
echo "Installing GUI apps..." | ||
|
||
brew tap homebrew/cask | ||
|
||
brew install bartender | ||
brew install choosy | ||
brew install cleanmymac | ||
brew install fantastical | ||
brew install figma | ||
brew install google-chrome | ||
brew install hammerspoon | ||
brew install kap | ||
brew install karabiner-elements | ||
brew install nordvpn | ||
brew install orbstack | ||
brew install rocket | ||
brew install wezterm | ||
|
||
# Install op cli | ||
brew tap 1password/tap | ||
brew install 1password-cli | ||
fi | ||
|
||
echo "Brew clean up..." | ||
brew cleanup | ||
|
||
echo "Installing fonts..." | ||
brew tap homebrew/cask-fonts | ||
brew install font-symbols-only-nerd-font | ||
brew install font-monaspace | ||
|
||
echo "Installing personal dotfiles..." | ||
git clone [email protected]:alistairstead/dotfiles.git ~/dotfiles | ||
|
||
cd ~/dotfiles || exit | ||
|
||
|
||
echo "Creating symlinks..." | ||
|
||
stow asdf bin direnv gh git hammerspoon karabiner kitty nvim ssh starship tmux wezterm yabai zsh | ||
|
||
echo "Install zap..." | ||
|
||
zsh <(curl -s https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) --branch release-v1 | ||
|
||
if test ! $(which asdf); then | ||
echo "Installing asdf..." | ||
# Documentation: https://asdf-vm.com | ||
# brew install asdf | ||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1 | ||
|
||
asdf plugin-add erlang | ||
asdf plugin-add elixir | ||
asdf plugin-add nodejs | ||
asdf plugin-add pnpm | ||
asdf plugin-add postgres | ||
asdf plugin-add php https://github.com/asdf-community/asdf-php.git | ||
asdf plugin-add direnv | ||
|
||
brew install \ | ||
coreutils automake autoconf openssl \ | ||
libyaml readline libxslt libtool unixodbc \ | ||
unzip curl gpg | ||
|
||
bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-release-team-keyring' | ||
fi | ||
|
||
test -f ~/.ssh/config.local || touch ~/.ssh/config.local | ||
|
||
if [ "$(uname -s)" = "Darwin" ]; then | ||
echo "Configuring git for mac-os settings..." | ||
# Don't ask ssh password all the time | ||
git config --global credential.helper osxkeychain | ||
# 1Password commit signing | ||
if test ! ENV["CI"]; then | ||
git config --global user.signingkey $(op item get 'SSH Key' --fields label='public key') | ||
git config --global gpg.format "ssh" | ||
git config --global gpg.ssh.program "/Applications/1Password.app/Contents/MacOS/op-ssh-sign" | ||
git config --global commit.gpgsign true | ||
fi | ||
else | ||
echo "Configuring git for linux..." | ||
# Don't ask ssh password all the time | ||
git config --global credential.helper cache | ||
fi | ||
|
||
git config --global core.excludesfile "${HOME}/.config/.gitignore" | ||
git config --global include.path "${HOME}/.config/.gitconfig" | ||
|
||
if test "${distro}" = "Darwin"; then | ||
echo "Configuring mac-os settings..." | ||
bash ./script/mac-settings.sh | ||
fi | ||
|
||
echo "Configuring tmux plugins..." | ||
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | ||
~/.tmux/plugins/tpm/bin/install_plugins | ||
|
||
echo "Done!" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# bootstrap installs things. | ||
|
||
cd "$(dirname "$0")/.." | ||
DOTFILES_ROOT=$(pwd -P) | ||
|
||
set -e | ||
|
||
echo '' | ||
|
||
info() { | ||
# shellcheck disable=SC2059 | ||
printf "\r [ \033[00;34m..\033[0m ] $1\n" | ||
} | ||
|
||
user() { | ||
# shellcheck disable=SC2059 | ||
printf "\r [ \033[0;33m??\033[0m ] $1\n" | ||
} | ||
|
||
success() { | ||
# shellcheck disable=SC2059 | ||
printf "\r\033[2K [ \033[00;32mOK\033[0m ] $1\n" | ||
} | ||
|
||
fail() { | ||
# shellcheck disable=SC2059 | ||
printf "\r\033[2K [\033[0;31mFAIL\033[0m] $1\n" | ||
echo '' | ||
exit | ||
} | ||
|
||
setup_gitconfig() { | ||
info 'setup gitconfig' | ||
if [ "$(git config --global --get dotfiles.managed)" != "true" ]; then | ||
# if there is no user.email, we'll assume it's a new machine/setup and ask it | ||
if [ -z "$(git config --global --get user.email)" ]; then | ||
user ' - What is your github author name?' | ||
read -r user_name | ||
user ' - What is your github author email?' | ||
read -r user_email | ||
|
||
git config --global user.name "$user_name" | ||
git config --global user.email "$user_email" | ||
fi | ||
|
||
# if user.email exists, let's check for dotfiles.managed config. If it is | ||
# not true, we'll backup the gitconfig file and set previous user.email and | ||
# user.name in the new one | ||
user_name="$(git config --global --get user.name)" | ||
user_email="$(git config --global --get user.email)" | ||
mv ~/.gitconfig ~/.gitconfig.backup | ||
success "moved ~/.gitconfig to ~/.gitconfig.backup" | ||
git config --global user.name "$user_name" | ||
git config --global user.email "$user_email" | ||
|
||
if [ -z "$(git config --global --get github.user)" ]; then | ||
user ' - What is your github username?' | ||
read -r username | ||
git config --global github.user "$username" | ||
fi | ||
if [ -z "$(git config --global --get github.oauth-token)" ]; then | ||
user ' - What is your github oauth-token?' | ||
read -r token | ||
git config --global github.oauth-token "$token" | ||
fi | ||
|
||
# include the gitconfig.local file | ||
git config --global include.path ~/.gitconfig.local | ||
# finally make git knows this is a managed config already, preventing later | ||
# overrides by this script | ||
git config --global dotfiles.managed true | ||
success 'git config managed by dotfiles' | ||
else | ||
# otherwise this gitconfig was already made by the dotfiles | ||
info "already managed by dotfiles" | ||
fi | ||
|
||
|
||
|
||
success 'gitconfig intalled!' | ||
} | ||
|
||
setup_gitconfig |
Oops, something went wrong.