-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_once_before_10-package-installation.sh.tmpl
111 lines (86 loc) · 3.21 KB
/
run_once_before_10-package-installation.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
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
#!/bin/bash
set -eufo pipefail
function chezmoi () {
if [[ -x "$HOME/bin/chezmoi" ]]; then
"$HOME/bin/chezmoi" "$@"
else
command chezmoi "$@"
fi
}
PKG_DIR="$(chezmoi source-path)"/dot_config/packages
{{ if (eq .chezmoi.os "darwin") -}}
xcode-select --install || true
if ! command -v brew; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# generate with `brew bundle dump`
brew bundle --no-lock --file="${PKG_DIR}/Brewfile"
{{ if .work -}}
brew bundle --no-lock --file="${PKG_DIR}/Brewfile-work"
{{ else -}}
brew bundle --no-lock --file="${PKG_DIR}/Brewfile-personal"
{{- end }}
/usr/local/bin/pip3 install --user pynvim jedi
{{ else if (eq .chezmoi.os "linux") -}}
{{ if (eq .chezmoi.osRelease.id "arch") -}}
sudo pacman -Syu
sudo pacman -S --needed - < "${PKG_DIR}/arch-pacman.txt"
if ! command -v yay; then
[[ -d /tmp/yay ]] && rm -rf /tmp/yay
git clone https://aur.archlinux.org/yay-git.git /tmp/yay
( cd /tmp/yay && makepkg -si )
rm -rf /tmp/yay
fi
yay -S --needed - < "${PKG_DIR}/arch-aur.txt"
{{ else if (eq .chezmoi.osRelease.id "ubuntu") -}}
# probably a simple install: we're going to install some things manually.
# reference for deleting the apt timer if it's there.
# sudo -v || true
# sudo systemctl stop unattended-upgrades
# sudo systemctl disable apt-daily.timer
# sudo systemctl disable apt-daily-upgrade.timer
# sudo apt remove unattended-upgrades || true
sudo apt update
sudo apt upgrade -yq
# xclip pass
sudo apt install -y \
zsh curl git wget zip vim \
jq fzf fd-find ripgrep pipx
# pip3 install --user pipx poetry
# download bob (version manager for neovim)
if [[ ! -x $HOME/.local/bin/bob ]]; then
mkdir -p $HOME/.local/bin
BOB_TAG="$(curl https://api.github.com/repos/MordechaiHadad/bob/releases/latest | jq -r '.tag_name')"
wget https://github.com/MordechaiHadad/bob/releases/download/${BOB_TAG}/bob-linux-x86_64-openssl.zip -O /tmp/bob.zip && \
unzip -j /tmp/bob.zip -d $HOME/.local/bin && \
rm /tmp/bob.zip && \
chmod +x $HOME/.local/bin/bob
fi
# antibody
# if ! which antibody; then
# curl -sfL git.io/antibody | sudo sh -s - -b /usr/local/bin
# fi
if [[ ! -x $HOME/.local/bin/lazygit ]]; then
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | jq -r '.tag_name')
curl -Lo /tmp/lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/download/${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION#v}_Linux_x86_64.tar.gz"
tar xf /tmp/lazygit.tar.gz -C $HOME/.local/bin/
rm /tmp/lazygit.tar.gz
fi
{{- end }}
{{- end }}
{{ if .work }}
# on work machines, we have artifactory set:
pip config set global.index-url "{{ .pypi_artifactory }}"
{{- end }}
# install pipx pkgs
# generate with `pipx list|grep package|awk '{print $2}'`
if ! PIPX_CURRENT="$(pipx list | grep package | awk '{print $2}'|| true)"; then
PIPX_CURRENT=""
fi
while read -r pkg || [[ -n "$pkg" ]]; do
pkg="$(echo "$pkg" | sed -e 's|.*/||' -e 's|\.git.*||' -e '/pywal/d')"
if ! grep "^${pkg}$" <<< "$PIPX_CURRENT" &>/dev/null; then
pipx install --force "$pkg"
fi
done < "${PKG_DIR}/pipx.txt"
# cargo install racer sccache