-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecipe.rb
More file actions
373 lines (342 loc) · 10.5 KB
/
recipe.rb
File metadata and controls
373 lines (342 loc) · 10.5 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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# Definitions
HOME_PATH = File.expand_path('~')
CURRENT_PATH = Dir.pwd
DOTFILES_REPO = 'https://github.com/corrupt952/dotfiles'
DOTFILES_PATH = File.join(HOME_PATH, 'Workspace', 'corrupt952', 'dotfiles')
DOTFILES_CONFIG_PATH = File.join(DOTFILES_PATH, 'home')
XDG_CONFIG_HOME = ENV.fetch('XDG_CONFIG_HOME', File.join(HOME_PATH, '.config'))
XDG_CACHE_HOME = ENV.fetch('XDG_CACHE_HOME', File.join(HOME_PATH, '.cache'))
XDG_DATA_HOME = ENV.fetch('XDG_DATA_HOME', File.join(HOME_PATH, '.local', 'share'))
XDG_STATE_HOME = ENV.fetch('XDG_STATE_HOME', File.join(HOME_PATH, '.local', 'state'))
ZDOTDIR = ENV.fetch('ZDOTDIR', File.join(HOME_PATH, '.config', 'zsh'))
ZINIT_HOME = ENV.fetch('ZINIT_HOME', File.join(HOME_PATH, '.zinit'))
define :touch, path: nil do
path = File.expand_path(params[:path])
execute "touch #{path}" do
command "touch #{path}"
end
end
# Ubuntu
result = run_command('[ "$(uname -s)" = "Linux" ] && [ -f /etc/lsb-release ] && grep -q Ubuntu /etc/lsb-release', error: false)
if result.success?
execute 'apt update' do
command 'sudo apt update'
end
%w(
locales-all ca-certificates build-essential
fonts-ipafont fonts-ipaexfont x11-xkb-utils
zsh vim wget
).each do |package|
package package do
user 'root'
action :install
end
end
# Docker
execute 'install keyrings' do
command 'sudo install -m 0755 -d /etc/apt/keyrings'
end
execute 'curl docker.asc' do
command 'sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc'
end
execute 'chmod docker.asc' do
command 'sudo chmod a+r /etc/apt/keyrings/docker.asc'
end
execute 'Make docker.list' do
command <<~COMMAND
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
COMMAND
end
execute 'apt update' do
command 'sudo apt update'
end
%w(docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin).each do |package|
package package do
user 'root'
action :install
end
end
execute 'apt autoremove' do
command 'sudo apt autoremove'
end
end
# Homebrew
execute 'brew update' do
command 'brew update'
end
%w(
automake bat cmake coreutils curl direnv deno fzf grep gpg gnu-sed jq libtool
ripgrep tig tmux tree wget wimlib arp-scan gh htop mise ollama aquaproj/aqua/aqua corrupt952/tmuxist/tmuxist
).each do |package|
brew package do
action :install
end
end
# Configure dotfiles
git 'corrupt952/dotfiles' do
not_if { File.exist?(DOTFILES_PATH) }
repository DOTFILES_REPO
destination DOTFILES_PATH
end
# Configure XDGs
directory XDG_CONFIG_HOME do
action :create
end
directory XDG_CACHE_HOME do
action :create
end
directory XDG_DATA_HOME do
action :create
end
directory XDG_STATE_HOME do
action :create
end
# Claude Code
directory File.join(HOME_PATH, '.claude') do
action :create
end
symlink File.join(HOME_PATH, '.claude', 'CLAUDE.md') do
source File.join(DOTFILES_CONFIG_PATH, '.claude', 'CLAUDE.md')
force true
end
symlink File.join(HOME_PATH, '.claude', 'rules') do
source File.join(DOTFILES_CONFIG_PATH, '.claude', 'rules')
force true
end
symlink File.join(HOME_PATH, '.claude', 'hooks') do
source File.join(DOTFILES_CONFIG_PATH, '.claude', 'hooks')
force true
end
# .local/bin
directory File.join(HOME_PATH, '.local') do
action :create
end
symlink File.join(HOME_PATH, '.local', 'bin') do
source File.join(DOTFILES_CONFIG_PATH, '.local', 'bin')
force true
end
# # Zsh
symlink File.join(HOME_PATH, '.zshenv') do
source File.join(DOTFILES_CONFIG_PATH, '.zshenv')
force true
end
symlink ZDOTDIR do
source File.join(DOTFILES_CONFIG_PATH, '.config', 'zsh')
force true
end
touch '.zshrc.local' do
path File.join(ZDOTDIR, '.zshrc.local')
end
git 'zinit' do
not_if { File.exist?(ZINIT_HOME) }
repository 'https://github.com/zdharma-continuum/zinit.git'
destination ZINIT_HOME
end
symlink File.join(XDG_CONFIG_HOME, 'zeno') do
source File.join(DOTFILES_CONFIG_PATH, '.config', 'zeno')
force true
end
# # Tmux
symlink File.join(HOME_PATH, '.tmux.conf') do
source File.join(DOTFILES_CONFIG_PATH, '.tmux.conf')
force true
end
symlink File.join(XDG_CONFIG_HOME, 'tmux') do
source File.join(DOTFILES_CONFIG_PATH, '.config', 'tmux')
force true
end
# # WezTerm
symlink File.join(XDG_CONFIG_HOME, 'wezterm') do
source File.join(DOTFILES_CONFIG_PATH, '.config', 'wezterm')
force true
end
# # OpenCode
directory File.join(XDG_CONFIG_HOME, 'opencode', 'plugins') do
action :create
end
symlink File.join(XDG_CONFIG_HOME, 'opencode', 'plugins', 'wezterm-notify.ts') do
source File.join(DOTFILES_CONFIG_PATH, '.config', 'opencode', 'plugins', 'wezterm-notify.ts')
force true
end
# # Git
symlink File.join(HOME_PATH, '.gitconfig') do
source File.join(DOTFILES_CONFIG_PATH, '.gitconfig')
force true
end
symlink File.join(XDG_CONFIG_HOME, 'git') do
source File.join(DOTFILES_CONFIG_PATH, '.config', 'git')
force true
end
touch '$XDG_CONFIG_HOME/git/local' do
path File.join(XDG_CONFIG_HOME, 'git', 'local')
end
# # direnv
symlink File.join(HOME_PATH, '.direnvrc') do
source File.join(DOTFILES_CONFIG_PATH, '.direnvrc')
force true
end
# # Ruby
symlink File.join(HOME_PATH, '.gemrc') do
source File.join(DOTFILES_CONFIG_PATH, '.gemrc')
force true
end
# # Darwin
result = run_command('[ "$(uname -s)" = "Darwin" ]', error: false)
if result.success?
%w(mas cocoapods).each do |package|
brew package do
action :install
end
end
# macOS defaults settings
# NSGlobalDomain
execute 'Set dark mode' do
command 'defaults write NSGlobalDomain AppleInterfaceStyle Dark'
end
execute 'Enable swipe navigation' do
command 'defaults write NSGlobalDomain AppleEnableSwipeNavigateWithScrolls -bool true'
end
execute 'Set natural scrolling' do
command 'defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false'
end
# Menu bar clock
execute 'Set 24-hour time format' do
command 'defaults write com.apple.menuextra.clock Show24Hour -bool true'
end
execute 'Hide day of week in clock' do
command 'defaults write com.apple.menuextra.clock ShowDayOfWeek -bool false'
end
execute 'Hide seconds in clock' do
command 'defaults write com.apple.menuextra.clock ShowSeconds -bool false'
end
# Control Center
execute 'Hide Focus Modes in Control Center' do
command 'defaults write com.apple.controlcenter "NSStatusItem Visible FocusModes" -bool false'
end
execute 'Hide Battery percentage in Control Center' do
command 'defaults write com.apple.controlcenter "NSStatusItem Visible BatteryShowPercentage" -bool false'
end
execute 'Hide Now Playing in Control Center' do
command 'defaults write com.apple.controlcenter "NSStatusItem Visible NowPlaying" -bool false'
end
execute 'Hide Sound in Control Center' do
command 'defaults write com.apple.controlcenter "NSStatusItem Visible Sound" -bool false'
end
execute 'Hide Bluetooth in Control Center' do
command 'defaults write com.apple.controlcenter "NSStatusItem Visible Bluetooth" -bool false'
end
execute 'Hide AirDrop in Control Center' do
command 'defaults write com.apple.controlcenter "NSStatusItem Visible AirDrop" -bool false'
end
# Trackpad
execute 'Enable tap to click' do
command 'defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true'
end
# Mission Control
execute 'Disable automatic space rearrangement' do
command 'defaults write com.apple.dock mru-spaces -bool false'
end
# Dock
execute 'Auto-hide Dock' do
command 'defaults write com.apple.dock autohide -bool true'
end
execute 'Hide recent apps in Dock' do
command 'defaults write com.apple.dock show-recents -bool false'
end
execute 'Disable Dock magnification' do
command 'defaults write com.apple.dock magnification -bool false'
end
execute 'Set Dock icon size' do
command 'defaults write com.apple.dock tilesize -int 64'
end
execute 'Set Dock large size' do
command 'defaults write com.apple.dock largesize -int 64'
end
execute 'Set Dock position' do
command 'defaults write com.apple.dock orientation bottom'
end
execute 'Set minimize effect' do
command 'defaults write com.apple.dock mineffect scale'
end
execute 'Disable launch animation' do
command 'defaults write com.apple.dock launchanim -bool false'
end
# Finder
execute 'Show all file extensions' do
command 'defaults write com.apple.finder AppleShowAllExtensions -bool true'
end
execute 'Show hidden files' do
command 'defaults write com.apple.finder AppleShowAllFiles -bool true'
end
execute 'Hide desktop icons' do
command 'defaults write com.apple.finder CreateDesktop -bool false'
end
execute 'Disable extension change warning' do
command 'defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false'
end
execute 'Show path bar in Finder' do
command 'defaults write com.apple.finder ShowPathbar -bool true'
end
execute 'Show status bar in Finder' do
command 'defaults write com.apple.finder ShowStatusBar -bool true'
end
# Apply changes
execute 'Restart Dock' do
command 'killall Dock'
end
execute 'Restart Finder' do
command 'killall Finder'
end
execute 'Restart SystemUIServer' do
command 'killall SystemUIServer'
end
[
# Browsers
'google-chrome', 'firefox',
# Utilities
'1password', '1password-cli', 'stats', 'raycast', 'obsidian', 'tailscale',
# Editors & IDEs
'visual-studio-code', 'cursor', 'codex', 'jetbrains-toolbox',
# Development
'flutter', 'orbstack', 'wezterm',
# Game Development
'unity-hub', 'godot',
# Communication
"discord",
# AI
'comfyui',
# Entertainment
'steam',
].each do |package|
brew package do
action :install
options ['--cask', '--appdir=/Applications']
end
end
print 'Do you want to install apps from the App Store? [y/N]: '
if $stdin.tty? && $stdin.gets.chomp.start_with?('y')
[
409183694, # Keynote
409201541, # Pages
409203825, # Numbers
408981434, # iMovie
682658836, # GarageBand
1246969117, # Steam Link
497799835, # Xcode
640199958, # Developer
# 899247664, # TestFlight
1631624924, # Final Cut Pro
1615087040, # Logic Pro
6746516157, # Compressor
6746637089, # MainStage
6746637149, # Motion
].each do |id|
execute "mas install #{id}" do
command "mas install #{id}"
end
end
end
end