-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.nu
90 lines (71 loc) · 2.46 KB
/
bootstrap.nu
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
use src/symlinks.nu symlink
use src/utils.nu ask_yes_no
export def main [] {
mkdir ~/src/work
mkdir ~/src/oss
# yt-dlp
let yt_dlp = "~/bin/yt-dlp" | path expand
if (not ($yt_dlp | path exists)) { http get https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp | save -f $yt_dlp }
# broot
let broot_config_dir = match $nu.os-info.name {
"windows" => '~\AppData\Roaming\dystroy\broot' ,
_ => "~/.config/broot" ,
}
if not ($broot_config_dir | path exists) { mkdir $broot_config_dir }
symlink --force ~/src/nushell-config/broot-config $broot_config_dir
# bacon
let bacon_config_dir = match $nu.os-info.name {
"windows" => '~\AppData\Roaming\dystroy\bacon\config' ,
"macos" => '~/Library/Application Support/org.dystroy.bacon' ,
_ => "~/.config/bacon" ,
}
if not ($bacon_config_dir | path exists) { mkdir $bacon_config_dir }
symlink --force ~/src/nushell-config/bacon-config $bacon_config_dir
# uv
if (which ^uv | is-empty ) {
match $nu.os-info.name {
"windows" => { powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" }
_ => { curl -LsSf https://astral.sh/uv/install.sh | sh },
}
}
# nushell
let nushell_dir = match $nu.os-info.name {
"windows" => '~\AppData\Roaming\nushell' ,
"macos" => "~/Library/Application Support/nushell" ,
_ => "~/.config/nushell" ,
}
if not ($nushell_dir | path exists) { mkdir $nushell_dir }
symlink --force ~/src/nushell-config/env.nu ($nushell_dir | path join "env.nu")
symlink --force ~/src/nushell-config/config.nu ($nushell_dir | path join "config.nu")
# python
config python
if $nu.os-info.name == 'linux' { linux-key-remap }
}
def "config python" [] {
mkdir ~/.pip/
# prevent pip from installing packages in the global installation
"
[install]
require-virtualenv = true
[uninstall]
require-virtualenv = true
" | save -f ~/.pip/pip.conf
}
def linux-key-remap [] {
if (not ('~/src/oss/keyd' | path exists)) {
git clone https://github.com/rvaiya/keyd ~/src/oss/keyd
cd ~/src/oss/keyd
make
sudo make install
"
[ids]
*
[main]
# Maps capslock to escape when pressed and control when held.
capslock = overload(control, esc)
# Remaps the escape key to capslock
esc = capslock
" | sudo tee /etc/keyd/default.conf
sudo systemctl enable --now keyd
}
}