-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.nu
More file actions
321 lines (284 loc) · 9.83 KB
/
Copy pathinstall.nu
File metadata and controls
321 lines (284 loc) · 9.83 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
echo "✨ Setting up install"
$env.catalog = []
# add homebrew tap
def tap [name: string] {
if $nu.os-info.name == "macos" {
brew tap $name
}
}
# queues install items
def --env install [
...names: string
--cask: string
--extras: string
--pacman: string
--su
--yay
] {
if $nu.os-info.name == "macos" {
if $cask != null {
brew install $cask --cask
} else {
brew install ...$names
}
} else if $nu.os-info.family == "windows" {
alias scoop = scoop
if $su {
alias scoop = winget
}
if $extras != null {
scoop install $"extras/($extras)"
} else {
scoop install ...$names
}
} else if $nu.os-info.name == "linux" {
alias pacman = sudo pacman
if $yay {
alias pacman = yay
}
if $pacman != null {
if $yay {
$env.yay_queue = $env.yay_queue | append [$pacman]
} else {
$env.pacman_queue = $env.pacman_queue | append [$pacman]
}
} else {
if $yay {
$env.yay_queue = $env.yay_queue | append $names
} else {
$env.pacman_queue = $env.pacman_queue | append $names
}
}
} else {
error make "OS not supported"
}
}
# creates a platform symlink
def --env link [
link: path
target: path
--file
] {
if (which ln | is-empty | not $in) {
if $file {
ln -f $link $target
} else {
ln -f -s $link $target
}
} else if (which mklink | is-empty | not $in) {
if $file {
mklink /h $link $target
} else {
mklink /d $link $target
}
}
}
# runs installation for queued installs. should be called before any dependant applications
# are executed.
def --env commit [] {
if $nu.os-info.name == "linux" {
if (try { $env.pacman_queue } | is-empty | not $in) {
$env.catalog = $env.catalog | append $env.pacman_queue
sudo pacman -S --noconfirm --needed ...$env.pacman_queue
}
if (try { $env.yay_queue } | is-empty | not $in) {
$env.catalog = $env.catalog | append $env.yay_queue
yay -S --noconfirm --needed ...$env.yay_queue
}
$env.pacman_queue = []
$env.yay_queue = []
}
}
def --env catalog [] {
print $"Installed ($env.catalog | length) items"
let external = pacman -Qqe | lines | where $in not-in $env.catalog
if ($external | is-empty | not $in) {
print $"(ansi yellow)Found ($external | length) installed externally(ansi reset)"
print $external
}
}
commit
tap oven-sh/bun
echo "✨ Installing configs"
# Install configs
install git
commit
let dotfiles = $"($nu.home-dir)/.dotfiles/"
try {
git clone https://github.com/noahbald/dotfiles $dotfiles
} catch {
try {
git -C $dotfiles pull origin main --ff-only
} catch {
git -C $dotfiles merge --no-ff
}
}
if $nu.os-info.name == "macos" {
link ($dotfiles | path join "private_Library/private_Application Support/lazygit/") $"($nu.home-dir)/Library/Application Support/lazygit/"
link ($dotfiles | path join "private_Library/private_Application Support/nushell/") $"($nu.home-dir)/Library/Application Support/nushell/"
link ($dotfiles | path join "private_Library/private_Application Support/com.mitchellh.ghostty/") $"($nu.home-dir)/Library/Application Support/com.mitchellh.ghostty/"
} else {
echo $"TODO: Support ($nu.os-info.name) application configs"
}
if (which zsh | is-empty | not $in) {
link ($dotfiles | path join "dot_zshrc") ~/.zshrc --file
link ($dotfiles | path join "zshrc.nu") ~/zshrc.nu --file
}
if (which bash | is-empty | not $in) {
link ($dotfiles | path join "dot_bashrc") ~/.bashrc --file
link ($dotfiles | path join "zshrc.nu") ~/zshrc.nu --file
}
link ($dotfiles | path join "dot_gitconfig") ~/.gitconfig --file
if ("~/.config" | path exists) or (try { ls ~/.config } | is-empty | not $in) {
error make "Please backup and delete ~/.config and try again"
}
link ($dotfiles | path join ".config") $nu.home-dir
try {
git clone https://github.com/nushell/nu_scripts ~/.config/nu_scripts/
} catch {
git -C $dotfiles pull origin main --ff-only
}
echo "✨ Installing applications"
let is_desktop = $nu.os-info.name == "macos" or $nu.os-info.family == "windows" or (which gnome-shell | is-empty | not $in) or (which hyprland | is-empty | not $in)
# Install essentials
install nushell # Shell
install starship # Prompt
install helix # Editor
install zellij # Multiplexer
# Install browsers
if ($is_desktop) {
install chrome --cask ungoogled-chromium --pacman chromium # Chromium
install zen --cask zen --yay --pacman zen-browser-bin # Firefox
}
# Install JavaScript runtimes
install mise # language manager
install vscode-langservers-extracted --yay
install prettierd --yay
install superhtml --yay --pacman superhtml-bin
commit
mise use -g node # V8 JS Runtime
mise use -g npm # Node package manager
sudo npm i -g @typescript/native-preview
sudo npm i -g yarn
sudo npm i -g gulp-cli
sudo npm i -g grunt-cli
mise use -g bun # Webkit JS Runtime
# Install Go runtimes
mise use -g go
install gopls
# Install Python Utils
mise use -g python
mise use -g uv # Python package manager
# Install Rust compilers
mise use -g rust
# Install CLang compilers
mise use -g zig
mise use -g zls
# Other language servers
install harper
install yaml-language-server
install marksman
install markdown-oxide
# Install utilities
install bat # Better cat
install dust # Readable file stats
install fastfetch # System info
install fd # Better find
install ripgrep # Better grep
install uutils-coreutils # Experimental Rust coreutils
install zoxide # Automated cd shortcuts
# Install TUIs
install bottom # Process monitoring
install fzf # Fuzzy finder
install lazygit # Git TUI
install scooter --yay --pacman scooter-bin # Search/replace
install yazi ffmpeg jq poppler resvg # Visual interactive cd (+ previewers and processors)
# Install agents
install claude --yay --pacman claude-code
install opencode
install ollama
# Install applications
if ($is_desktop) {
install spotify --extras spotify --cask spotify --pacman spotify-launcher
install obsidian --cask obsidian
install ghostty
install ttf-jetbrains-mono-nerd
install ttf-atkinson-hyperlegible
if $nu.os-info.name == "linux" {
install vulkan-icd-loader
install wl-clipboard
install plocate # like fd, but pre-indexed
}
}
if $nu.os-info.name == "macos" {
install raycast
install ice --cask jordanbarid-ice
}
if $nu.os-info.family == "windows" {
# Install MS C++ Build Tools (https://visualstudio.microsoft.com/visual-cpp-build-tools/)
install-su Microsoft.VisualStudio.2022.BuildTools --force --override "--wait --passive --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22000"
}
if $nu.os-info.name == "linux" {
install networkmanager
install iwd # connect to wifi devices
install bluetui impala # device tuis
install kernel-modules-hook # kernel upgrade handler
install man-db # remote manuals
install unzip # decompression
install whois # searches ownership of domain name
install wireless-regdb # prevent illegal use of radio frequencies
install pacman-contrib
commit
sudo systemctl enable --now NetworkManager.service
}
if (which gnome-shell | is-empty | not $in) {
# Install subset of [gnome](https://archlinux.org/groups/x86_64/gnome/) group
install gdm gnome-backgrounds gnome-color-manager gnome-control-center gnome-disk-utility gnome-logs gnome-menus gnome-session gnome-settings-daemon evince loupe nautilus papers showtime snapshot sushi xdg-desktop-portal-gnome xdg-user-dirs-gtk
}
if (which hyprland | is-empty | not $in) {
install hypridle hyprland-guiutils hyprlock hyprsunset
install --yay hyprland-preview-share-picker-git
install xdg-desktop-portal-gtk xdg-desktop-portal-hyprland
install qt5-wayland qt6-wayland uwsm # waylands
install greetd # login
install polkit # auth toolkit
install hyprpolkitagent # polkit auth daemon
install mako # notification daemon
install swaybg # wallpaper
install swayosd # control notifications
install waybar # sidebar
install --yay elephant-bin elephant-providerlist-bin elephant-desktopapplications-bin # launcher backend
install --yay walker-bin # app launcher
install nautilus sushi # file explorer
install evince # document viewer
install grim slurp # screenshots
install --yay gpu-screen-recorder
install brightnessctl
commit
systemctl --user enable --now hyprpolkitagent.service
elephant service enable
systemctl --user start elephant.service
sudo ln -f -s ($dotfiles | path join "etc/greet") /etc/greetd
}
commit
echo "✨ Setting up environment"
# Init applications
zoxide init nushell | save -f ~/.zoxide.nu
mkdir ~/.cache/starship
starship init nu | save -f ~/.cache/starship/init.nu
catalog
echo "✨ All done"
mut dont_forget = ""
if $nu.os-info.family == "windows" {
$dont_forget = "- Install Visual Studio C++
"
}
if $nu.os-info.name == "linux" {
$dont_forget = "- Install GPU drivers for your hardware (for desktop)
- Reboot
"
}
nu -c $"\"Don't forget to
- Set up ssh keys \(https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent\)
- Update `~/.gitignore` email
($dont_forget)- To smile :\)\""