-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_onchange_after_package-installer.sh.tmpl
67 lines (58 loc) · 2.49 KB
/
run_onchange_after_package-installer.sh.tmpl
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
#!/usr/bin/env bash
# ensure its a rdev machine
{{- if (and (eq .chezmoi.os "linux") (contains "rdev" (env "RDEV_ID")) (eq "coder" .chezmoi.username) (eq "/home/coder" .chezmoi.homeDir)) }}
curl -fsSL https://pixi.sh/install.sh | bash
if [[ $? -ne 0 ]]; then
curl -L -o ~/.pixi/bin/pixi https://github.com/prefix-dev/pixi/releases/download/v0.40.3/pixi-x86_64-unknown-linux-musl
chmod +x ~/.pixi/bin/pixi
fi
packages=("tmux" "nvim" "ripgrep" "fzf" "fd-find" "zoxide" "eza" "git-delta" "bat" "direnv" "jq" "yq" "sqlite" "lua" "luajit" "luarocks")
for package in "${packages[@]}"; do
$HOME/.pixi/bin/pixi global install "$package"
done
{{- else }}
# use devox only on mac or linux but not on rdev
if [[ ! $(command -v devbox 2>/dev/null) ]]; then
curl -fsSL https://get.jetify.com/devbox | bash
fi
eval "$(devbox global shellenv --preserve-path-stack -r)" && hash -r 2>/dev/null
{{- end }}
if [[ ! -d $HOME/.nvim-env ]]; then
if [[ -f /export/apps/python/3.10/bin/python3 ]]; then
/export/apps/python/3.10/bin/python3 -m venv "$HOME"/.nvim-env
"$HOME"/.nvim-env/bin/python -m pip install neovim
fi
fi
setup_shell() {
# install powerlevel10k
if [[ ! -d $HOME/powerlevel10k ]]; then
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
fi
# install zsh plugins
PLUGIN_DIR="$HOME/.zsh/plugins"
if [[ ! -d "$PLUGIN_DIR" ]]; then
mkdir -p "$PLUGIN_DIR"
fi
declare -A PLUGINS=(["fast-syntax-highlighting"]="https://github.com/zdharma-continuum/fast-syntax-highlighting,"
["zsh-autosuggestions"]="https://github.com/zsh-users/zsh-autosuggestions,"
["zsh-completions"]="https://github.com/zsh-users/zsh-completions,"
["zsh-history-substring-search"]="https://github.com/zsh-users/zsh-history-substring-search,"
["fzf-tab"]="https://github.com/Aloxaf/fzf-tab,"
["zsh-vi-mode"]="https://github.com/jeffreytse/zsh-vi-mode,"
["zsh-abbr"]="https://github.com/olets/zsh-abbr,--recurse-submodules --single-branch --branch main --depth 1")
for plugin_name in "${!PLUGINS[@]}"; do
plugin_info="${PLUGINS[$plugin_name]}"
plugin_path="${PLUGIN_DIR}/$plugin_name"
# Split plugin_info into plugin_url and plugin_args
IFS=',' read -r plugin_url plugin_args <<<"$plugin_info"
plugin_path="${PLUGIN_DIR}/$plugin_name"
if [[ ! -d "$plugin_path" ]]; then
echo "Installing $plugin_name"
cmd="git clone $plugin_url $plugin_args $plugin_path"
eval $cmd
# else
# echo "$plugin_name is already installed...at $plugin_path/$plugin_name.plugin.zsh"
fi
done
}
setup_shell