-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·135 lines (114 loc) · 3.31 KB
/
setup.sh
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
#!/usr/bin/env bash
trap "exit" INT
# https://gist.github.com/vratiu/9780109
Color_Off="\033[0m" # Text Reset
Black="\033[0;30m" # Black
Red="\033[0;31m" # Red
Green="\033[0;32m" # Green
Yellow="\033[0;33m" # Yellow
Blue="\033[0;34m" # Blue
Purple="\033[0;35m" # Purple
Cyan="\033[0;36m" # Cyan
White="\033[0;37m" # White
function symlink() {
ln -sf $1 $2
}
function log_start() {
echo -e "${Blue}$1${Color_Off}"
}
function log_end() {
echo -e "${Green}$1${Color_Off}"
}
function eval_brew() {
eval "$(/opt/homebrew/bin/brew shellenv)"
eval "$(fnm env --use-on-cd)"
}
DOT=$HOME/.dotfiles
CONFIG=$HOME/.config
LOCAL=$HOME/.local
TMUX=$CONFIG/tmux
mkdir -p $CONFIG
mkdir -p $TMUX
log_start "🔗 Symlinking dotfiles..."
symlink $DOT/zsh/.antigenrc $HOME/.antigenrc
symlink $DOT/zsh/.zshrc $HOME/.zshrc
symlink $DOT/zsh/.zprofile $HOME/.zprofile
symlink $DOT/aerospace.toml $HOME/.aerospace.toml
symlink $DOT/.tmux/.tmux.conf $TMUX/tmux.conf
symlink $DOT/tmux/.tmux.conf.local $TMUX/tmux.conf.local
symlink $DOT/tmux/.tmux-cht-command $HOME/.tmux-cht-command
symlink $DOT/tmux/.tmux-cht-languages $HOME/.tmux-cht-languages
symlink $DOT/.gitconfig $HOME/.gitconfig
if ! test -e $LOCAL/bin/scripts; then
symlink $DOT/bin/scripts $LOCAL/bin
fi
if ! test -e $CONFIG/ghostty then
symlink $DOT/ghostty $CONFIG
fi
log_end "Symlinks created"
log_start "🔠 Copying Fonts..."
cp -R $DOT/fonts/* $HOME/Library/Fonts
log_end "fonts copied"
log_start "🍺 Installing Homebrew..."
if ! eval_brew; then
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval_brew
echo -n 'export PATH=/Applications/flameshot.app//Contents/MacOS/:$PATH' >> $HOME/.zshenv # gross 🤢
log_end 'Brew installed'
else
log_end 'Brew detected'
fi
log_start "💎 Installing from Brewfile..."
brew bundle --file $DOT/Brewfile
cw theme poimandres
log_end "Formulae and casks installed"
echo
log_start "🦠 Setting up zsh and antigen..."
if ! test -e $HOME/antigen.zsh; then
curl -L git.io/antigen > antigen.zsh
log_end "zsh setup complete"
else
log_end "antigen config detected"
fi
echo
log_start "🦀 Installing Rust..."
if ! command -v rustc &> /dev/null; then
rustup-init -y
log_end "Rust installed"
else
rustc -V
log_end "Rust detected"
fi
echo
log_start "🐫 Installing OCaml..."
if ! command -v opam &> /dev/null; then
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
opam init
opam switch create 4.14.1
opam install dune merlin ocaml-lsp-server odoc ocamlformat utop dune-release
log_end "OCaml installed"
else
ocaml --version
log_end "OCaml detected"
fi
echo
log_start "🐢 Installing node and package managers..."
if ! command -v node &> /dev/null; then
fnm use 18 --install-if-missing
npm i -g yarn pnpm @antfu/ni
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://bun.sh/install | bash)"
log_end "NodeJS installed"
else
node -v
log_end "NodeJS detected"
fi
echo
log_start "🧙 Configuring neovim..."
if ! test -e $CONFIG/nvim; then
symlink $DOT/nvim $CONFIG
log_end "nvim config setup"
else
log_end "nvim config detected"
fi
cat doc.txt | lolcat
log_end "🎉 Done!"