-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
Β·177 lines (140 loc) Β· 4.91 KB
/
install.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/bash
# A utility script to set up a new macOS environment
set -euo pipefail
echo -e "\nπ The World Changed! Beginning MacOS setup...\n"
# Ask for user inputs at the beginning
read -r -p "ο£Ώ Would you like to set macOS preferences now? (y/N): " macos_preferences_confirm
ZSHHOME="$HOME/dotfiles/zsh"
# Function to create directories
create_dirs() {
echo "π Creating directories..."
local dirs=(
"$HOME/Codes"
"$HOME/Documents/Screenshots"
"$HOME/Downloads/Torrents"
)
for dir in "${dirs[@]}"; do
mkdir -p "$dir"
echo "Created $dir"
done
}
# Function to install Xcode Command Line Tools
install_xcode_tools() {
echo "π Installing Xcode Command Line Tools..."
if ! xcode-select --print-path &>/dev/null; then
xcode-select --install &>/dev/null
until xcode-select --print-path &>/dev/null; do
sleep 5
done
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
else
echo "π©» Xcode Command Line Tools already installed."
fi
}
# Function to install Homebrew and packages
install_brew() {
echo "πΊ Installing Homebrew and packages..."
if ! command -v brew &>/dev/null; then
export HOMEBREW_NO_INSTALL_FROM_API=1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >>~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
echo "πΊ Updating Homebrew..."
brew update --force
echo "πΊ Installing packages..."
brew bundle --file="$HOME/dotfiles/Brewfile"
}
# Function to set macOS preferences
set_macos_preferences() {
if [[ "$macos_preferences_confirm" =~ ^[yY](es)?$ ]]; then
echo "ο£Ώ Setting macOS preferences..."
source "$HOME/dotfiles/macos/.macos"
else
echo "ο£Ώ Skipping macOS preferences setup."
fi
}
# Function to configure Node and Bun
configure_node() {
echo "π¦ Configuring Node..."
npm install -g n &>/dev/null
curl -fsSL https://bun.sh/install | bash
echo "π Baked bun -v$($HOME/.bun/bin/bun --version)"
}
# Function to install tmux plugin manager
install_tmux_plugins() {
local folder="$HOME/.tmux/plugins/tpm"
local url="https://github.com/tmux-plugins/tpm"
[ -d "$folder" ] || git clone "$url" "$folder"
}
# Function to install Yazi themes
install_yazi_themes() {
local folder="$HOME/.config/yazi/flavors"
local url="https://github.com/yazi-rs/flavors.git"
[ -d "$folder" ] || git clone "$url" "$folder"
}
# Function for additional setups
setup_utils() {
# Install git large files
git lfs install
# Productive laziness
# Goose
curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | CONFIGURE=false bash
# LLM
uv tool list | grep -q "llm" && uv tool upgrade llm || uv tool install llm
export PATH="$HOME/.local/bin:$PATH"
llm --system 'Reply with linux terminal commands only, no extra information' --save cmd
llm --system 'Reply with neovim commands only, no extra infromation' --save nvim
# Aider and Posting
# Aider
uv tool list | grep -q "aider" && uv tool upgrade aider-chat || uv tool install aider-chat --python 3.11
uv tool list | grep -q "posting" && uv tool upgrade posting || uv tool install posting --python 3.11
# Add Claude and Ollama
llm install llm-anthropic llm-ollama &>/dev/null
# Set Claude as defult
llm models default claude-3.5-sonnet-latest
# better scripts
rgr --version | grep -q "repgrep" || cargo install repgrep
[ -f "$HOME/.rgrc" ] || touch "$HOME/.rgrc"
# custom scripts
for file in $HOME/dotfiles/bin/*.py; do
cp "$file" "$HOME/.local/bin/$(basename "${file%.py}")"
done
}
# Function to create Python virtual environments
create_virtualenvs() {
echo "π Creating Python Virtual Environments..."
local envs=(
"$HOME/.virtualenvs/neovim|pynvim"
"$HOME/.virtualenvs/debugpy|pynvim debugpy ruff"
)
mkdir -p "$HOME/.virtualenvs"
for env in "${envs[@]}"; do
IFS='|' read -r dir packages <<<"$env"
if [ ! -d "$dir" ]; then
uv venv "$dir" &>/dev/null
fi
source $dir/bin/activate
uv pip install --upgrade $packages #&>/dev/null
deactivate
done
echo "π₯ Virtual environments and π¦ packages installed."
}
# Function to use GNU Stow to manage dotfiles
stow_dotfiles() {
echo "π Stowing dotfiles..."
stow --adopt -d "$HOME/dotfiles" -t "$HOME" fzf git ghostty nvim sesh starship tmux vim zsh yazi aerospace
}
# Main setup sequence
create_dirs
install_xcode_tools
set_macos_preferences
install_brew
configure_node
create_virtualenvs
install_tmux_plugins
install_yazi_themes
setup_utils
stow_dotfiles
echo "π¦ The World is restored. Setup completed successfully!"