generated from ublue-os/boxkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-devtools
More file actions
executable file
·88 lines (68 loc) · 2.63 KB
/
install-devtools
File metadata and controls
executable file
·88 lines (68 loc) · 2.63 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
#!/bin/sh
set -e
dl_extract() {
_archive="${1##*/}"
_extract_dir="${_archive%.*}"
_checksum="$2"
curl -fLo "$_archive" "$1"
if [ -n "$_checksum" ]; then
printf '%s %s\n' "$_checksum" "$_archive" | sha256sum -c >&2
else
printf 'warning: no checksum provided for %s; archive will not be verified\n' "$_archive" >&2
fi
mkdir -p "$_extract_dir"
case "$_archive" in
*.tar.gz | *.tgz | *.tar.bz2 | *.tar.xz | *.tar)
tar -xf "$_archive" --no-same-owner --no-same-permissions -C "$_extract_dir"
;;
*.zip)
unzip -q "$_archive" -d "$_extract_dir"
;;
esac
rm "$_archive"
printf '%s' "$_extract_dir"
}
gh_release_data() {
_repo="$1"
_version="$2"
_fname_filter="$3"
curl -s "https://api.github.com/repos/$_repo/releases/$_version" |
jq -r ".assets[] | select(.name | contains(\"$_fname_filter\")) | .browser_download_url, (.digest | ltrimstr(\"sha256:\"))"
}
tmp_dir=$(mktemp -d)
install_prefix="/usr/local"
trap 'rm -rf $tmp_dir' EXIT
cd "$tmp_dir"
npm install -g typescript typescript-language-server
npm install -g svelte-language-server
npm install -g pyright
RUST_HOME="/opt/rust"
export CARGO_HOME="$RUST_HOME"
export RUSTUP_HOME="$RUST_HOME"
rustup-init -y --default-toolchain stable --no-modify-path
"$RUST_HOME"/bin/rustup component add rust-analyzer
GOBIN="$install_prefix/bin" go install golang.org/x/tools/gopls@latest
UV_TOOL_BIN_DIR="$install_prefix/bin" UV_TOOL_DIR="/opt/uv/venv" uv tool install ruff
curl -fLO https://raw.githubusercontent.com/ryanpz/zig-swap/refs/heads/main/zig-swap
chmod +x zig-swap
cp zig-swap "$install_prefix"/bin
nvim_data="$(gh_release_data 'neovim/neovim' 'tags/nightly' 'nvim-linux-x86_64.tar.gz')"
nvim_dir="$(dl_extract \
"$(printf '%s' "$nvim_data" | head -n1)" \
"$(printf '%s' "$nvim_data" | head -n2 | tail -n1)")"
cp -r "$nvim_dir"/nvim-*/bin "$nvim_dir"/nvim-*/lib "$nvim_dir"/nvim-*/share "$install_prefix"
emmylua_data="$(gh_release_data 'EmmyLuaLs/emmylua-analyzer-rust' 'latest' 'emmylua_ls-linux-x64.tar.gz')"
emmylua_dir="$(dl_extract \
"$(printf '%s' "$emmylua_data" | head -n1)" \
"$(printf '%s' "$emmylua_data" | head -n2 | tail -n1)")"
cp "$emmylua_dir"/emmylua_ls "$install_prefix"/bin
jj_data="$(gh_release_data 'jj-vcs/jj' 'latest' 'x86_64-unknown-linux-musl')"
jj_dir="$(dl_extract \
"$(printf '%s' "$jj_data" | head -n1)" \
"$(printf '%s' "$jj_data" | head -n2 | tail -n1)")"
cp "$jj_dir"/jj "$install_prefix"/bin
stylua_data="$(gh_release_data 'JohnnyMorganz/StyLua' 'latest' 'stylua-linux-x86_64.zip')"
stylua_dir="$(dl_extract \
"$(printf '%s' "$stylua_data" | head -n1)" \
"$(printf '%s' "$stylua_data" | head -n2 | tail -n1)")"
cp "$stylua_dir"/stylua "$install_prefix"/bin