-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·205 lines (175 loc) · 7.73 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·205 lines (175 loc) · 7.73 KB
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/usr/bin/env bash
set -e
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PRIVATE_DOTFILES_DIR="${PRIVATE_DOTFILES_DIR:-$HOME/git/private/dotfiles}"
if [[ ! -d "$PRIVATE_DOTFILES_DIR" ]]; then
echo "[error] private dotfiles not found at $PRIVATE_DOTFILES_DIR"
echo "[error] clone or set up your private repo first, then rerun install.sh"
exit 1
fi
link_file() {
local src="$1"
local dest="$2"
mkdir -p "$(dirname "$dest")"
rm -rf "$dest"
ln -s "$src" "$dest"
}
link_private_if_exists() {
local src="$1"
local dest="$2"
if [[ -e "$src" ]]; then
echo "[exec] linking private $(basename "$dest")"
link_file "$src" "$dest"
fi
}
link_private_executable_if_exists() {
local src="$1"
local dest="$2"
if [[ -e "$src" ]]; then
echo "[exec] linking private $(basename "$dest")"
mkdir -p "$(dirname "$dest")"
chmod +x "$src"
if [[ -e "$dest" && ! -L "$dest" ]]; then
echo "[error] refusing to overwrite non-symlink: $dest"
exit 1
fi
ln -sfn "$src" "$dest"
fi
}
clone_repo_if_missing() {
local repo_url="$1"
local dest="$2"
if [[ -d "$dest/.git" ]]; then
return
fi
if [[ -e "$dest" ]]; then
echo "[warn] $dest exists but is not a git repo; skipping clone"
return
fi
mkdir -p "$(dirname "$dest")"
git clone "$repo_url" "$dest" || echo "[warn] failed to clone $repo_url"
}
echo "[exec] hi :)"
echo "[exec] installing xcode tools"
xcode-select --install || true
# Check for Homebrew
if ! command -v brew &> /dev/null; then
echo "[exec] installing homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo "[exec] installing oh-my-zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo "[exec] making zsh the default shell"
chsh -s /bin/zsh
echo "[exec] cloning codiff source"
clone_repo_if_missing "https://github.com/nkzw-tech/codiff.git" "$HOME/git/oss/codiff"
# Install fonts (optional but recommended for powerlevel10k)
echo "[exec] installing fonts"
brew tap homebrew/cask-fonts || true
# brew install --cask font-fira-code || true
# brew install --cask font-jetbrains-mono || true
echo "[exec] linking dotfiles"
mkdir -p ~/.zsh
mkdir -p ~/.config/karabiner
mkdir -p ~/.config/gh
mkdir -p ~/.config/git
mkdir -p ~/.config/ghostty
mkdir -p ~/.config/oh-my-posh
mkdir -p ~/.config/secrets
mkdir -p ~/.config/zed
mkdir -p ~/.codex
mkdir -p ~/.codiff
mkdir -p ~/.local/bin
mkdir -p ~/.ssh
link_file "$DOTFILES_DIR/zsh/zprofile" "$HOME/.zprofile"
link_file "$DOTFILES_DIR/zsh/zshrc" "$HOME/.zshrc"
link_file "$DOTFILES_DIR/zsh/alias.zsh" "$HOME/.zsh/alias.zsh"
link_file "$DOTFILES_DIR/zsh/functions.zsh" "$HOME/.zsh/functions.zsh"
link_file "$DOTFILES_DIR/.tmux.conf" "$HOME/.tmux.conf"
link_file "$DOTFILES_DIR/apps/karabiner/karabiner.json" "$HOME/.config/karabiner/karabiner.json"
link_file "$DOTFILES_DIR/config/gh/config.yml" "$HOME/.config/gh/config.yml"
link_file "$DOTFILES_DIR/config/ghostty/config" "$HOME/.config/ghostty/config"
link_file "$DOTFILES_DIR/config/codiff/codiff.jsonc" "$HOME/.codiff/codiff.jsonc"
link_file "$DOTFILES_DIR/config/oh-my-posh/config.json" "$HOME/.config/oh-my-posh/config.json"
link_file "$DOTFILES_DIR/config/zed/settings.json" "$HOME/.config/zed/settings.json"
link_file "$DOTFILES_DIR/gitconfig" "$HOME/.gitconfig"
link_file "$DOTFILES_DIR/gitignore_global" "$HOME/.gitignore_global"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/zsh/env.zsh" "$HOME/.config/secrets/env.zsh"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/zsh/private.zsh" "$HOME/.config/secrets/private.zsh"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/git/config.private" "$HOME/.config/git/config.private"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/git/allowed_signers" "$HOME/.config/git/allowed_signers"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/config/gh/hosts.yml" "$HOME/.config/gh/hosts.yml"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/config/codex/hooks.json" "$HOME/.codex/hooks.json"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/ssh/config" "$HOME/.ssh/config"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/apps/sublime/User/MySFTP/servers/server.json" "$HOME/Library/Application Support/Sublime Text/Packages/User/MySFTP/servers/server.json"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/agents" "$HOME/.agents"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/agents/AGENTS.md" "$HOME/.codex/AGENTS.md"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/agents/skills" "$HOME/.codex/skills"
link_private_if_exists "$PRIVATE_DOTFILES_DIR/agents/prompts" "$HOME/.codex/prompts"
link_private_executable_if_exists "$PRIVATE_DOTFILES_DIR/bin/committer" "$HOME/.local/bin/committer"
link_private_executable_if_exists "$PRIVATE_DOTFILES_DIR/bin/setup-mail-automation" "$HOME/.local/bin/setup-mail-automation"
link_private_executable_if_exists "$PRIVATE_DOTFILES_DIR/bin/setup-codex-plugins" "$HOME/.local/bin/setup-codex-plugins"
sublime_user_dir="$HOME/Library/Application Support/Sublime Text/Packages/User"
sublime_dotfiles_dir="$DOTFILES_DIR/apps/sublime/User"
mkdir -p "$sublime_user_dir"
if [[ -d "$sublime_dotfiles_dir" ]]; then
while IFS= read -r -d '' src_file; do
rel="${src_file#"$sublime_dotfiles_dir"/}"
case "$rel" in
*.example.json) continue ;;
esac
mkdir -p "$sublime_user_dir/$(dirname "$rel")"
ln -sf "$src_file" "$sublime_user_dir/$rel"
done < <(find "$sublime_dotfiles_dir" -type f -print0)
fi
echo "[exec] running brew bundle"
brew bundle --file="$DOTFILES_DIR/Brewfile" || echo "[warn] brew bundle failed, continuing..."
export PATH="$(brew --prefix)/bin:$PATH"
echo "[exec] installing vite plus"
if ! bash -o pipefail -c 'curl -fsSL https://vite.plus | bash'; then
echo "[warn] vite plus install failed, continuing..."
fi
if [[ -f "$HOME/.vite-plus/env" ]]; then
source "$HOME/.vite-plus/env"
fi
echo "[exec] configuring vite plus"
if command -v vp &> /dev/null; then
vp env on || echo "[warn] vite plus managed mode setup failed, continuing..."
corepack enable || echo "[warn] vite plus package manager shim setup failed, continuing..."
vp install -g \
ccusage@latest \
@pspdfkit/pdf-to-markdown@latest \
@tobilu/qmd@latest \
mcporter@latest \
typescript@latest || echo "[warn] vite plus global package setup failed, continuing..."
else
echo "[warn] vite plus not found; skipping JavaScript tool setup"
fi
echo "[exec] installing private Codex plugins"
if [[ -x "$PRIVATE_DOTFILES_DIR/bin/setup-codex-plugins" ]]; then
"$PRIVATE_DOTFILES_DIR/bin/setup-codex-plugins" || echo "[warn] private Codex plugin setup failed, continuing..."
else
echo "[warn] private Codex plugin setup not found; skipping"
fi
# Install micromamba for Python environment management
echo "[exec] installing micromamba"
if ! command -v micromamba &> /dev/null; then
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C /usr/local/bin bin/micromamba
micromamba shell init -s zsh -p ~/micromamba
fi
echo "[exec] installing powerlevel10k theme"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
echo "[exec] installing zsh plugins"
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
echo "[exec] setting up git lfs"
git lfs install || true
echo "[exec] cleaning up"
brew cleanup
brew doctor || true
echo "[exec] done!"
echo "[exec] Next steps:"
echo " 1. Configure powerlevel10k: p10k configure"
echo " 2. Review ~/.zsh/alias.zsh and edit as needed"
echo " 3. Restart your terminal or: exec zsh"
echo " 4. Open Sublime Text and run: Package Control: Satisfy Dependencies (if any packages are missing)"