-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·145 lines (131 loc) · 3.96 KB
/
install.sh
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
#!/usr/bin/env bash
set -euo pipefail
BACKUP_DIR="${BACKUP_DIR:-$HOME/dotfiles_backupi_$(date +%s%N)}"
CONFIG_DIR=$HOME/.config
CONFIG_DOT_DIR=$HOME/dotfiles/config
DOT_DIR=$HOME/dotfiles
FONTS_DIR=$HOME/dotfiles/fonts
UTILS_DIR=$HOME/dotfiles/utils
BINFILES=/usr/local/bin
install_extra_packages=1
install_nvim=1
while getopts ":en" opt; do
case ${opt} in
e)
install_extra_packages=0
;;
n)
install_nvim=0
;;
\?)
echo "Invalid option: -$OPTARG" 1>&2
exit 1
;;
esac
done
_yay() {
pushd $HOME
sudo pacman -S --needed base-devel
git clone https://aur.archlinux.org/yay.git
pushd yay
makepkg -si --noconfirm
popd
rm -fr yay
popd
# Color
sudo sed -i 's/^#Color/Color/' /etc/pacman.conf
}
_nvm() {
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
source $HOME/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install node --lts
}
base_packages() {
sudo pacman -Syy --noconfirm
sudo pacman -S bat fzf unzip viewnior scrot clang arandr fd ripgrep zsh alacritty neovim tmux font-manager gnome-themes-extra pcmanfm pavucontrol bluez blueman bluez-utils pulseaudio-bluetooth xclip xorg-xkill git-delta dunst --noconfirm
_nvm
_yay
# Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
yay -S i3-scrot --noconfirm
sudo systemctl enable bluetooth.service
}
config_dirs_link() {
local src=$CONFIG_DOT_DIR
local dst=$CONFIG_DIR
rm -fr $CONFIG_DIR
mkdir $CONFIG_DIR
ln -s $src/i3 $dst/i3
ln -s $src/alacritty $dst/alacritty
ln -s $src/gtk-3.0 $dst/gtk-3.0
ln -s $src/i3status $dst/i3status
ln -s $src/dunst $dst/dunst
if [[ $install_nvim -eq 1 ]]; then
ln -s $src/nvim $dst/nvim
fi
ln -s -f $src/i3-scrot.conf $dst/i3-scrot.conf
i3 reload
# Move BIN helpers
ln -s $UTILS_DIR/ord_version.sh $BINFILES/ord_v
ln -s $UTILS_DIR/init_dev_env.sh $BINFILES/ide
ln -s $UTILS_DIR/clear_cache.sh $BINFILES/clear_cache
ln -s $UTILS_DIR/move_mouse.sh $BINFILES/move_mouse
}
terminal() {
# change shell
sudo chsh -s $(which zsh) $(whoami)
# Set gobal env variables
echo $'EDITOR=nvim\nTERMINAL=alacritty' | sudo tee -a /etc/environment
# OMZ
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
ln -s -f $DOT_DIR/zshrc $HOME/.zshrc
# OMT
pushd $HOME
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .
popd
# p10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
ln -s -f $DOT_DIR/p10k.zsh $HOME/.p10k.zsh
}
fonts() {
font-manager -i $FONTS_DIR/*
yay -S noto-fonts-emoji-apple --noconfirm
i3 reload
}
extra_conf() {
ln -s -f $DOT_DIR/gtkrc-2.0 $HOME/.gtkrc-2.0
# i3 lock service
sudo ln -s -f $DOT_DIR/i3lock.service /etc/systemd/system/i3lock.service
sudo systemctl enable i3lock.service
# clang-format 2-4 spaces indent
ln -s -f $DOT_DIR/clang-format $HOME/.clang-format
# gitconfig
sudo ln -s -f $DOT_DIR/gitconfig $HOME/.gitconfig
# keyboard win-alt on mechanical
ln -s -f $DOT_DIR/Xmodmap $HOME/.Xmodmap
ln -s -f $DOT_DIR/xinitrc $HOME/.xinitrc
# Arandr configs
ln -s -f $DOT_DIR/screenlayout $HOME/.screenlayout
# Utils custom commands
ln -s $DOT_DIR/utils/run_loop.sh /usr/local/bin/run_loop
}
extra_packages() {
yay -S microsoft-edge-stable-bin ledger-live-bin --noconfirm
sudo pacman -S telegram-desktop bitwarden --noconfirm
}
main() {
base_packages
fonts
config_dirs_link
terminal
extra_conf
if [[ $install_extra_packages -eq 1 ]]; then
extra_packages
fi
}
main