/
install
executable file
·155 lines (139 loc) · 6.59 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/usr/bin/env bash
set -eEuo pipefail
DOTFILES_DIR=~/dotfiles
mkdir -p ~/.local/bin
# zsh
echo 'installing zsh configuration...'
if [[ -f "$HOME/.zshrc" ]]; then
echo '- backing up existing .zshrc...'
mv ~/.zshrc ~/.zshrc-backup
fi
if [[ -f "$HOME/.zshenv" ]]; then
echo '- backing up existing .zshenv...'
mv ~/.zshenv ~/.zshenv-backup
fi
ln -sf "${DOTFILES_DIR}/zsh/.zshrc" ~/.zshrc
ln -sf "${DOTFILES_DIR}/zsh/.zshenv" ~/.zshenv
ln -sf "${DOTFILES_DIR}/zsh/.em.zsh" ~/.local/bin
ln -sf "${DOTFILES_DIR}/zsh/.zsh_favlist" ~/.zsh_favlist
# vim
echo 'installing vim configuration...'
mkdir -p ~/.config/nvim
ln -sf "${DOTFILES_DIR}/vim/colors.vim" ~/.config/nvim/colors.vim
ln -sf "${DOTFILES_DIR}/vim/colors" ~/.config/nvim/colors
ln -sf "${DOTFILES_DIR}/vim/commands.vim" ~/.config/nvim/commands.vim
ln -sf "${DOTFILES_DIR}/vim/events.vim" ~/.config/nvim/events.vim
ln -sf "${DOTFILES_DIR}/vim/functions.vim" ~/.config/nvim/functions.vim
ln -sf "${DOTFILES_DIR}/vim/init.vim" ~/.config/nvim/init.vim
ln -sf "${DOTFILES_DIR}/vim/keymaps.vim" ~/.config/nvim/keymaps.vim
ln -sf "${DOTFILES_DIR}/vim/plugins.vim" ~/.config/nvim/plugins.vim
ln -sf "${DOTFILES_DIR}/vim/settings.vim" ~/.config/nvim/settings.vim
# tmux
echo 'installing tmux configuration...'
ln -sf "${DOTFILES_DIR}/tmux/.tmux.conf" ~/.tmux.conf
ln -sf "${DOTFILES_DIR}/tmux/.tmux-osx.conf" ~/.tmux-osx.conf
mkdir -p ~/.local/bin
# ctags
echo 'installing ctags configuration...'
ln -sf "${DOTFILES_DIR}/ctags/.ctags" ~/.ctags
# alacritty
echo 'installing alacritty configuration...'
mkdir -p ~/.config/alacritty
ln -sf "${DOTFILES_DIR}/alacritty/alacritty.yml" ~/.config/alacritty.yml
# kitty
echo 'installing kitty configuration...'
mkdir -p ~/.config/kitty
ln -sf "${DOTFILES_DIR}/kitty/kitty.conf" ~/.config/kitty.conf
# starship
echo 'installing starship configuration...'
mkdir -p ~/.config
ln -sf "${DOTFILES_DIR}/starship.toml" ~/.config/starship.toml
echo 'setting up terminfo file...'
tic -x -o ~/.terminfo "${DOTFILES_DIR}/terminfo-24bit.src"
# if [[ $(uname) == "Darwin" ]]; then
# echo 'setting up homebrew and packages...'
# command -v brew >/dev/null \
# || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# packages="autoconf automake aws-iam-authenticator awscli bash bat cloc cmake coreutils diff-so-fancy editorconfig et exa fd fileicon fontconfig freetype git glib gmp gnu-sed gnu-tar gnupg gnutls go golangci-lint graphviz jpeg jq kubernetes-cli libpng librsvg libtasn1 libtermkey libtiff libtool libuv libvterm lzo make msgpack musl-cross ncurses neovim nmap node oniguruma openjpeg openssl@1.1 pcre2 pkg-config protobuf python python@3.8 rainbarf readline reattach-to-user-namespace ripgrep shared-mime-info shellcheck sk skhd starship terraform tmux unbound upx webp wget x265 xsv xz yabai yq zenith zplug zsh"
# brew install $packages
# brew upgrade $packages
# # emacs is special...
# brew install --with-dbus --with-imagemagick --with-jansson --with-modules --with-natural-title-bar --with-xml2 --HEAD emacs-mac \
# || brew reinstall emacs-mac
# cp -av /usr/local/opt/emacs-mac/Emacs.app /Applications/
# fileicon set /Applications/Emacs.app ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/Emacs-icon.icns
# casks="alacritty osxfuse wireshark-chmodbpf"
# installed_casks=$(brew cask ls)
# for cask in $casks; do
# if ! echo "$installed_casks" | grep -q "$cask"; then
# brew cask install "$cask"
# fi
# done
# # macOS only: install emacs into /Applications and fix its icon
# echo "setting up local unbound server..."
# set -e
#
# # macOS only: setup unbound as a local recursive dns server
# set -xeEuo pipefail
# sudo dscl . -create /Groups/_unbound
# sudo dscl . -create /Groups/_unbound PrimaryGroupID 444
# sudo dscl . -create /Users/_unbound
# sudo dscl . -create /Users/_unbound RecordName _unbound unbound
# sudo dscl . -create /Users/_unbound RealName "Unbound DNS server"
# sudo dscl . -create /Users/_unbound UniqueID 444
# sudo dscl . -create /Users/_unbound PrimaryGroupID 444
# sudo dscl . -create /Users/_unbound UserShell /usr/bin/false
# sudo dscl . -create /Users/_unbound Password '*'
# sudo dscl . -create /Groups/_unbound GroupMembership _unbound
# sudo cp "${DOTFILES_DIR}/unbound/unbound.conf" /usr/local/etc/unbound/unbound.conf
# # TODO: transform file using dns_blocklist_updater
# scp wireguard.mattsawyer.net:/var/lib/unbound/ads.conf /tmp/ads.conf
# sudo chown root /tmp/ads.conf
# sudo mv /tmp/ads.conf /usr/local/etc/unbound/zone-block-general.conf
# sudo unbound-anchor -a /usr/local/etc/unbound/root.key
# # sudo unbound-control-setup -d /usr/local/etc/unbound
# sudo chown -R _unbound:staff /usr/local/etc/unbound
# sudo chmod 640 /usr/local/etc/unbound/*
# sudo cp "${DOTFILES_DIR}/unbound/net.unbound.plist" /Library/LaunchDaemons/net.unbound.plist
# curl --output /tmp/root.hints https://www.internic.net/domain/named.cache
# sudo mv /tmp/root.hints /usr/local/etc/unbound/root.hints
# if ! pgrep -flai unbound; then
# echo "starting unbound..."
# sudo launchctl load /Library/LaunchDaemons/net.unbound.plist
# echo "checking unbound status..."
# sleep 2
# pgrep -flai unbound
# else
# echo "restarting unbound..."
# sudo launchctl unload /Library/LaunchDaemons/net.unbound.plist
# sleep 2
# sudo launchctl load /Library/LaunchDaemons/net.unbound.plist
# echo "checking unbound status..."
# sleep 2
# pgrep -flai unbound
# fi
# echo "setting nameservers to 127.0.0.1..."
# networksetup -setdnsservers Wi-Fi 127.0.0.1
# fi
# git
current_git_user=$(git config --global user.email)
if [[ "$current_git_user" != "m.sawyer@f5.com" ]]; then
git config --global user.email "matt.sawyer@gmail.com"
git config --global user.name "Matt Sawyer"
fi
git config --global pull.rebase false
git config --global push.default simple
git config --global alias.lp "log --format='%C(yellow) %h %C(green)%m %cn, %cr %D%C(cyan bold)%m %<(80,trunc)%s%C(reset) %C(normal)%C(reset)'"
git config --global alias.lpg "log --graph --format='%C(yellow) %h %C(green)%m %cn, %cr %D%C(cyan bold)%m %<(80,trunc)%s%C(reset) %C(normal)%C(reset)'"
# doom emacs
if command -v emacs >/dev/null; then
ln -sf "${DOTFILES_DIR}/doom" ~/.config/doom
test -d ~/.emacs.d || git clone https://github.com/hlissner/doom-emacs ~/.emacs.d
(cd ~/.emacs.d && git checkout develop && git pull)
~/.emacs.d/bin/doom -y install
else
echo "emacs is not installed! skipping doom setup."
fi
# go
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
ln -sf "${DOTFILES_DIR}/go/golangci.yaml" ~/.golangci.yaml