-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·347 lines (300 loc) · 12.3 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·347 lines (300 loc) · 12.3 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
#!/bin/bash
#
# install.sh - Setup script for ThinkPad X1 Carbon Fedora 43 configuration
#
# This script symlinks configuration files from this repository to your
# home directory. Run this after cloning the repo to set up your environment.
#
set -e
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Define the repo directory (the location of this script)
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo -e "${GREEN}============================================${NC}"
echo -e "${GREEN} ThinkPad X1 Carbon Config Installer${NC}"
echo -e "${GREEN}============================================${NC}"
echo ""
# ============================================================
# 0. Initialize git submodules (zsh plugins)
# ============================================================
echo -e "${YELLOW}Initializing git submodules...${NC}"
cd "$REPO_DIR"
git submodule update --init --recursive
echo " ✓ Git submodules initialized"
# ============================================================
# 1. Create XDG Config Directories
# ============================================================
echo -e "${YELLOW}Creating config directories...${NC}"
mkdir -p ~/.config/niri
mkdir -p ~/.config/swayidle
mkdir -p ~/.config/ghostty
mkdir -p ~/.config/systemd/user
mkdir -p ~/.config/zsh
mkdir -p ~/.config/environment.d
mkdir -p ~/.config/vim/ftplugin
mkdir -p ~/.config/vim/autoload
mkdir -p ~/.config/git
mkdir -p ~/.config/lsd
mkdir -p ~/.config/xdg-desktop-portal
mkdir -p ~/.local/bin
mkdir -p ~/.local/share/vim/plugged
mkdir -p ~/.local/share/applications
mkdir -p ~/Apps
mkdir -p ~/.cache/vim/{swap,backup,undo}
mkdir -p ~/.cache/wget
mkdir -p ~/Pictures/Wallpapers
mkdir -p ~/Pictures/Screenshots
# ============================================================
# 2. Symlink Bash Configuration (login shell, auto-starts niri)
# ============================================================
echo -e "${YELLOW}Linking Bash configuration...${NC}"
if [ -f "$REPO_DIR/configs/bash/.bash_profile" ]; then
ln -sf "$REPO_DIR/configs/bash/.bash_profile" ~/.bash_profile
echo " ✓ .bash_profile"
fi
# ============================================================
# 3. Symlink ZSH Configuration (used by ghostty)
# ============================================================
echo -e "${YELLOW}Linking ZSH configuration...${NC}"
# .zshenv needs to be in both locations:
# - ~/.zshenv: for SSH/fallback when ZDOTDIR isn't set
# - ~/.config/zsh/.zshenv: for graphical sessions where environment.d sets ZDOTDIR
if [ -f "$REPO_DIR/configs/zsh/.zshenv" ]; then
ln -sf "$REPO_DIR/configs/zsh/.zshenv" ~/.zshenv
ln -sf "$REPO_DIR/configs/zsh/.zshenv" ~/.config/zsh/.zshenv
echo " ✓ .zshenv"
fi
# Main zshrc
if [ -f "$REPO_DIR/configs/zsh/.zshrc" ]; then
ln -sf "$REPO_DIR/configs/zsh/.zshrc" ~/.config/zsh/.zshrc
echo " ✓ .zshrc"
fi
# ZSH plugins (git submodules)
for plugin in zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search spaceship; do
if [ -d "$REPO_DIR/configs/zsh/$plugin" ]; then
ln -sfn "$REPO_DIR/configs/zsh/$plugin" ~/.config/zsh/$plugin
echo " ✓ $plugin"
fi
done
# ============================================================
# 2b. Symlink Environment Variables (systemd environment.d)
# ============================================================
echo -e "${YELLOW}Linking environment.d configuration...${NC}"
for conf in "$REPO_DIR/configs/environment.d/"*.conf; do
if [ -f "$conf" ]; then
conf_name=$(basename "$conf")
ln -sf "$conf" ~/.config/environment.d/"$conf_name"
echo " ✓ $conf_name"
fi
done
# ============================================================
# 3. Symlink VIM Configuration
# ============================================================
echo -e "${YELLOW}Linking VIM configuration...${NC}"
# Main vimrc
if [ -f "$REPO_DIR/configs/vim/vimrc" ]; then
ln -sf "$REPO_DIR/configs/vim/vimrc" ~/.config/vim/vimrc
echo " ✓ vimrc"
fi
# ftplugin files
for ftplugin in "$REPO_DIR/configs/vim/ftplugin/"*.vim; do
if [ -f "$ftplugin" ]; then
ftplugin_name=$(basename "$ftplugin")
ln -sf "$ftplugin" ~/.config/vim/ftplugin/"$ftplugin_name"
echo " ✓ ftplugin/$ftplugin_name"
fi
done
# ============================================================
# 4. Symlink Git Configuration
# ============================================================
echo -e "${YELLOW}Linking Git configuration...${NC}"
for gitconfig in "$REPO_DIR/configs/git/"*; do
if [ -f "$gitconfig" ]; then
config_name=$(basename "$gitconfig")
ln -sf "$gitconfig" ~/.config/git/"$config_name"
echo " ✓ git/$config_name"
fi
done
# ============================================================
# 5. Symlink lsd Configuration
# ============================================================
echo -e "${YELLOW}Linking lsd configuration...${NC}"
if [ -f "$REPO_DIR/configs/lsd/config.yaml" ]; then
ln -sf "$REPO_DIR/configs/lsd/config.yaml" ~/.config/lsd/config.yaml
echo " ✓ lsd config"
fi
if [ -f "$REPO_DIR/configs/lsd/colors.yaml" ]; then
ln -sf "$REPO_DIR/configs/lsd/colors.yaml" ~/.config/lsd/colors.yaml
echo " ✓ lsd colors"
fi
# ============================================================
# 6. Symlink Niri & Desktop Configuration
# ============================================================
echo -e "${YELLOW}Linking desktop configuration...${NC}"
# Niri window manager config
if [ -f "$REPO_DIR/configs/niri/config.kdl" ]; then
ln -sf "$REPO_DIR/configs/niri/config.kdl" ~/.config/niri/config.kdl
echo " ✓ niri config"
fi
# Swayidle config
if [ -f "$REPO_DIR/configs/swayidle/config" ]; then
ln -sf "$REPO_DIR/configs/swayidle/config" ~/.config/swayidle/config
echo " ✓ swayidle config"
fi
# Ghostty terminal config
if [ -f "$REPO_DIR/configs/ghostty/config" ]; then
ln -sf "$REPO_DIR/configs/ghostty/config" ~/.config/ghostty/config
echo " ✓ ghostty config"
fi
# Noctalia shell config (symlink entire directory)
if [ -d "$REPO_DIR/configs/noctalia" ]; then
rm -rf ~/.config/noctalia
ln -sfn "$REPO_DIR/configs/noctalia" ~/.config/noctalia
echo " ✓ noctalia config"
fi
# XDG Desktop Portal config (niri-specific portal settings)
if [ -f "$REPO_DIR/configs/xdg-desktop-portal/portals.conf" ]; then
ln -sf "$REPO_DIR/configs/xdg-desktop-portal/portals.conf" ~/.config/xdg-desktop-portal/portals.conf
echo " ✓ xdg-desktop-portal config"
fi
# Fcitx5 input method config
if [ -d "$REPO_DIR/configs/fcitx5" ]; then
mkdir -p ~/.config/fcitx5
ln -sf "$REPO_DIR/configs/fcitx5/profile" ~/.config/fcitx5/profile
ln -sf "$REPO_DIR/configs/fcitx5/config" ~/.config/fcitx5/config
echo " ✓ fcitx5 config"
fi
# Claude Code settings
if [ -f "$REPO_DIR/configs/claude/settings.json" ]; then
mkdir -p ~/.claude
ln -sf "$REPO_DIR/configs/claude/settings.json" ~/.claude/settings.json
echo " ✓ claude settings"
fi
# ============================================================
# 7. Symlink Scripts to ~/.local/bin
# ============================================================
echo -e "${YELLOW}Linking scripts...${NC}"
for script in "$REPO_DIR/scripts/"*; do
if [ -f "$script" ]; then
script_name=$(basename "$script")
ln -sf "$script" ~/.local/bin/"$script_name"
chmod +x ~/.local/bin/"$script_name"
echo " ✓ $script_name"
fi
done
# ============================================================
# 8. Symlink Systemd User Services
# ============================================================
echo -e "${YELLOW}Linking systemd user services...${NC}"
for unit in "$REPO_DIR/systemd/"*.{service,timer}; do
if [ -f "$unit" ]; then
unit_name=$(basename "$unit")
ln -sf "$unit" ~/.config/systemd/user/"$unit_name"
echo " ✓ $unit_name"
fi
done
# ============================================================
# 9. Reload Systemd and Enable Services
# ============================================================
echo -e "${YELLOW}Reloading systemd user daemon...${NC}"
systemctl --user daemon-reload
# Enable the session target services (don't start yet, wait for graphical session)
echo -e "${YELLOW}Enabling user services...${NC}"
systemctl --user enable swayidle.service 2>/dev/null || true
systemctl --user enable noctalia.service 2>/dev/null || true
systemctl --user enable gh-token-reminder.timer 2>/dev/null || true
# ============================================================
# 10. Install vim-plug
# ============================================================
if [ ! -f ~/.config/vim/autoload/plug.vim ]; then
echo -e "${YELLOW}Installing vim-plug...${NC}"
curl -fLo ~/.config/vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo " ✓ vim-plug installed"
fi
# ============================================================
# 12. Setup Flatpak and Install Desktop Apps
# ============================================================
echo -e "${YELLOW}Setting up Flatpak...${NC}"
if ! flatpak remote-list | grep -q flathub; then
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
echo " ✓ Flathub repository added"
else
echo " ✓ Flathub repository already configured"
fi
echo -e "${YELLOW}Installing Flatpak apps...${NC}"
if ! flatpak list --user | grep -q com.slack.Slack; then
flatpak install --user -y flathub com.slack.Slack
echo " ✓ Slack installed"
else
echo " ✓ Slack already installed"
fi
if ! flatpak list --user | grep -q md.obsidian.Obsidian; then
flatpak install --user -y flathub md.obsidian.Obsidian
echo " ✓ Obsidian installed"
else
echo " ✓ Obsidian already installed"
fi
# Configure Flatpak apps for Wayland (Electron apps need explicit Ozone platform)
echo -e "${YELLOW}Configuring Flatpak apps for Wayland...${NC}"
flatpak override --user --socket=wayland --socket=session-bus \
--env=ELECTRON_OZONE_PLATFORM_HINT=wayland \
--env=ELECTRON_ENABLE_WAYLAND_IME=1 \
com.slack.Slack
echo " ✓ Slack Wayland + IME override"
flatpak override --user --socket=wayland --socket=session-bus --socket=system-bus \
--env=ELECTRON_OZONE_PLATFORM_HINT=wayland \
--env=ELECTRON_ENABLE_WAYLAND_IME=1 \
md.obsidian.Obsidian
echo " ✓ Obsidian Wayland + IME override"
# ============================================================
# 13. Install AI CLI Tools (user-space)
# ============================================================
echo -e "${YELLOW}Installing AI CLI tools...${NC}"
# Configure npm to use user directory (avoids /usr which is read-only in bootc)
npm config set prefix ~/.npm-global 2>/dev/null || true
# Gemini CLI
if ! command -v gemini &>/dev/null; then
npm install -g @google/gemini-cli
echo " ✓ Gemini CLI"
else
echo " ✓ Gemini CLI (already installed)"
fi
# Claude Code
if ! command -v claude &>/dev/null; then
curl -fsSL https://claude.ai/install.sh | bash
echo " ✓ Claude Code"
else
echo " ✓ Claude Code (already installed)"
fi
# OpenCode
if ! command -v opencode &>/dev/null; then
curl -fsSL https://opencode.ai/install | bash
echo " ✓ OpenCode"
else
echo " ✓ OpenCode (already installed)"
fi
# ============================================================
# Done!
# ============================================================
echo ""
echo -e "${GREEN}============================================${NC}"
echo -e "${GREEN} Setup Complete!${NC}"
echo -e "${GREEN}============================================${NC}"
echo ""
echo -e "Next steps:"
echo -e " 1. Log out and log back in (or run 'zsh') to use zsh"
echo -e " 2. Run 'vim +PlugInstall +qall' to install vim plugins"
echo -e " 3. In vim, run ':CocInstall coc-pyright coc-toml coc-yaml coc-json coc-clangd coc-rust-analyzer coc-go coc-sh'"
echo -e " 4. Log out and select 'niri' from the session menu"
echo -e " 5. Run 'secrets-store' to set up API keys in keyring"
echo -e " 6. Place your wallpaper at ~/Pictures/Wallpapers/default.jpg"
echo -e " 7. Run 'gcloud auth login' to authenticate Google Cloud"
echo -e " 8. Run 'gh auth login' to authenticate GitHub CLI"
echo ""
echo -e "${YELLOW}Configuration files are symlinked. Edit them in:${NC}"
echo -e " $REPO_DIR/configs/"
echo ""
echo -e "${YELLOW}Tip: To apply niri config changes, press Mod+Shift+R${NC}"