-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall
More file actions
executable file
·129 lines (107 loc) · 4.64 KB
/
Copy pathInstall
File metadata and controls
executable file
·129 lines (107 loc) · 4.64 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
#!/bin/bash
export DOTDOT="${HOME}/bin/nix_conf"
safe_ln() {
local src="$1"
local dest="$2"
if [[ ! -e "$src" ]]; then
echo "Error: Source file does not exist: $src" >&2
return 1
fi
if [[ -L "$dest" && "$(readlink "$dest")" == "$src" ]]; then
return 0
fi
if [[ -e "$dest" && ! -L "$dest" ]]; then
echo "Error: $dest exists and is not a symlink." >&2
echo "Please resolve manually: move or delete $dest, then re-run Install" >&2
return 1
fi
ln -sfn "$src" "$dest" || {
echo "Error: Failed to create symlink: $dest -> $src" >&2
return 1
}
return 0
}
mkdir -p ~/.gemini/antigravity-cli ~/.claude ~/.ssh ~/.config/kitty ~/.pip ~/.tmp ~/Library/Application\ Support/espanso
safe_ln "${DOTDOT}/bashrc" ~/.bashrc
if ! grep -q "\.bashrc" ~/.bash_profile 2>/dev/null; then
echo ". ~/.bashrc" > ~/.bash_profile
fi
if [[ $- == *i* ]]; then
source ~/.bashrc 2>/dev/null
fi
for rc in inputrc fdignore ctags pythonstartup ackrc editorconfig ideavimrc pdbrc virtualenv aider.conf.yml; do
safe_ln "${DOTDOT}/$rc" ~/."$rc"
done
for rc in git/gitconfig git/gitk vim/vimrc vim/vim tmux/tmux.conf; do
safe_ln "${DOTDOT}/$rc" ~/."$(basename "$rc")"
done
safe_ln "${DOTDOT}/ai/antigravity_settings.json" ~/.gemini/antigravity-cli/settings.json
safe_ln "${DOTDOT}/ai/antigravityignore" ~/.gemini/antigravity-cli/.antigravityignore
safe_ln "${DOTDOT}/ai/antigravityignore" ~/.gemini/antigravity-cli/.geminiignore
safe_ln "${DOTDOT}/ai/antigravityignore" ~/.gemini/.geminiignore
# Claude config is its own private repo
read -p "Do you want to clone/update private GitHub repositories (e.g., Claude config)? [y/N]: " clone_choice
if [[ "$clone_choice" =~ ^[Yy]$ ]]; then
if [ ! -d "$HOME/.claude/.git" ]; then
git clone https://github.com/edwelker/claude.git "$HOME/.claude"
else
git -C "$HOME/.claude" pull --ff-only 2>/dev/null || true
fi
fi
if [ -f "$HOME/.claude/CLAUDE.md" ]; then
safe_ln "$HOME/.claude/CLAUDE.md" ~/CLAUDE.md
fi
# Inject MCP config into ~/.claude.json (the file Claude Code manages)
if [ -f "$HOME/.claude/mcp-servers.json" ]; then
if [ -f "$HOME/.claude.json" ]; then
jq --slurpfile mcp "$HOME/.claude/mcp-servers.json" \
'.users.mcpServers = $mcp[0]' "$HOME/.claude.json" > /tmp/claude.json.tmp \
&& mv /tmp/claude.json.tmp "$HOME/.claude.json"
else
echo '{"users":{"mcpServers":{}}}' | jq --slurpfile mcp "$HOME/.claude/mcp-servers.json" \
'.users.mcpServers = $mcp[0]' > "$HOME/.claude.json"
fi
fi
safe_ln "${DOTDOT}/ssh/config" ~/.ssh/config
safe_ln "${DOTDOT}/kitty.conf" ~/.config/kitty/kitty.conf
safe_ln "${DOTDOT}/pip.conf" ~/.pip/pip.conf
safe_ln "${DOTDOT}/.prettierrc.json" ~/.prettierrc.json
safe_ln "${DOTDOT}/espanso/config" ~/Library/Application\ Support/espanso/config
safe_ln "${DOTDOT}/espanso/match" ~/Library/Application\ Support/espanso/match
# Install or update Antigravity CLI
if ! command -v agy &> /dev/null; then
echo "Installing Antigravity CLI..."
curl -fsSL https://antigravity.google/cli/install.sh | bash
else
echo "Antigravity CLI is already installed. Running update check..."
agy update || true
fi
if [[ -d "${DOTDOT}/.git" ]]; then
read -p "Do you want to update git submodules? [y/N]: " update_submodules
if [[ "$update_submodules" =~ ^[Yy]$ ]]; then
echo "Updating public submodules..."
git -C "${DOTDOT}" submodule update --init \
vim/vim/autoload/vim-plug \
base16-iterm2 \
syntax-highlighting \
misc_submodules/fzf-git.sh 2>/dev/null || echo "Warning: Failed to update public submodules" >&2
if [[ "$clone_choice" =~ ^[Yy]$ ]]; then
echo "Updating private submodules..."
git -C "${DOTDOT}" submodule update --init claude-config 2>/dev/null || echo "Warning: Failed to update private submodules" >&2
fi
fi
fi
# On ewelker* machines, ensure machine-local gitconfig override exists
if [[ "$(hostname)" == ewelker* ]]; then
if [ ! -f "${DOTDOT}/git/gitconfig.rs" ]; then
if [ -f "${DOTDOT}/git/gitconfig.rs.example" ]; then
cp "${DOTDOT}/git/gitconfig.rs.example" "${DOTDOT}/git/gitconfig.rs"
echo "Created git/gitconfig.rs from example — review and customize it."
else
echo "Note: on an ewelker* machine but git/gitconfig.rs is missing. Create it for machine-local git overrides."
fi
fi
fi
# app-configs/ contains application backup files (Picard, Thunderbird, Witch).
# These are archives for reference only — nothing in there gets symlinked.
echo "Installation complete!"