Skip to content

Instantly share code, notes, and snippets.

@DNI9
Last active May 27, 2023 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DNI9/12b6c2c977229fa419e2336c1752ac9c to your computer and use it in GitHub Desktop.
Save DNI9/12b6c2c977229fa419e2336c1752ac9c to your computer and use it in GitHub Desktop.
Install basic stuffs on newly installed arch distro: https://git.io/J9GnI
#!/usr/bin/env bash
check_package() {
if ! pacman -Qs "$1" >/dev/null; then
echo "$1 is not installed"
return 1
fi
}
promt() {
read -rp "$1" ans
[[ $ans =~ ^([yY])$ ]] && return 0
return 1
}
install_yay() {
echo "Installing yay..."
git clone https://aur.archlinux.org/yay-bin.git ~/Documents/yay
cd ~/Documents/yay || exit
makepkg -Csif
cd || exit
}
check_package yay || install_yay
echo '---------------------------------------------------------------------------'
sync_pacman() {
sudo pacman -Syy
sudo pacman -S --needed --noconfirm archlinux-keyring
sudo pacman-key --populate
sudo pacman -Syyu --noconfirm
printf "\nReboot is recommended\n"
sleep 1
}
promt "Sync repo and update system...? " && sync_pacman
echo '---------------------------------------------------------------------------'
install_packages() {
yay -S --noconfirm --needed base-devel cronie git neovim fnm-bin starship zoxide fzf exa bat alacritty \
brave-bin neofetch htop xfce4-power-manager xorg-xsetroot volumeicon keepassxc xclip tree git-delta \
yt-dlp yarn telegram-desktop tealdeer git-fuzzy-git paru-bin zsh downgrade sxhkd reflector \
shellcheck-bin ripgrep rofi ranger pulsemixer playerctl mpv lxappearance kvantum-qt5 qt5ct \
numlockx gnome-keyring visual-studio-code-bin auto-cpufreq ananicy-git gnu-netcat acpilight \
nordic-darker-theme cutefish-icons betterlockscreen dunst brightnessctl maim slop rofi-greenclip \
nerd-fonts-jetbrains-mono ttf-material-design-icons-git picom-pijulius-git ytfzf hsetroot python-pywal \
i3-resurrect polybar i3-gaps
# yay -S --needed --noconfirm timeshift timeshift-autosnap grub-btrfs
# for package in "${_packages[@]}"; do
# if ! yay -S --noconfirm --needed "$package"; then
# echo "$package" | tee -a failed_packages >/dev/null
# fi
# done
}
promt "Install other packages...? " && install_packages
echo '---------------------------------------------------------------------------'
clone_stuff() {
[[ -d ~/.config/nvim ]] && rm -rf ~/.config/nvim
git clone https://github.com/dni9/nvchad ~/.config/nvim
git clone git@github.com:DNI9/grub2-themes.git ~/Documents/grub2-themes
git clone git@github.com:DNI9/dwm.git ~/Documents/dwm
}
promt "Clone neovim config, grub2 theme, dwm, etc...? " && clone_stuff
echo '---------------------------------------------------------------------------'
setup_dots() {
rm -f ~/.zshrc
git clone --bare https://github.com/DNI9/dotfiles-wm.git "$HOME"/.dotfiles
/usr/bin/git --git-dir="$HOME"/.dotfiles/ --work-tree="$HOME" config --local status.showUntrackedFiles no
/usr/bin/git --git-dir="$HOME"/.dotfiles/ --work-tree="$HOME" checkout
}
promt "Setup dotfiles...? " && setup_dots
echo '---------------------------------------------------------------------------'
install_zsh_stuffs() {
rm -rf ~/.oh-my-zsh
yay -S --needed --noconfirm oh-my-zsh-git
sudo git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git /usr/share/oh-my-zsh/custom/plugins/zsh-syntax-highlighting
sudo git clone --depth 1 https://github.com/kazhala/dotbare.git /usr/share/oh-my-zsh/custom/plugins/dotbare
sudo git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions /usr/share/oh-my-zsh/custom/plugins/zsh-autosuggestions
sudo git clone --depth 1 https://github.com/zsh-users/zsh-completions /usr/share/oh-my-zsh/custom/plugins/zsh-completions
sudo git clone --depth 1 https://github.com/marlonrichert/zsh-autocomplete /usr/share/oh-my-zsh/custom/plugins/zsh-autocomplete
}
promt "Install ZSH stuffs and plugins...? " && install_zsh_stuffs
echo '---------------------------------------------------------------------------'
setup_git_ssh() {
ssh-keygen -t ed25519 -C "itsr9boi@gmail.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
xclip -selection clipboard <~/.ssh/id_ed25519.pub
echo "SSH key copied to clipboard, add it to github, then run ssh git@github.com"
}
promt "Setup git SSH...? " && setup_git_ssh
echo '---------------------------------------------------------------------------'
setup_services() {
sudo systemctl enable auto-cpufreq
sudo systemctl enable ananicy
# TODO: add nohang
echo "Reboot now"
}
promt "Setup services e.g ananicy, auto-cpufreq...? " && setup_services
echo '---------------------------------------------------------------------------'
enable_chaotic() {
sudo pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com
sudo pacman-key --lsign-key FBA220DFC880C036
sudo pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
echo -e "\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist" | sudo tee -a /etc/pacman.conf >/dev/null
sudo pacman -Syy
}
promt "Enable chaotic AUR...? " && enable_chaotic
echo '---------------------------------------------------------------------------'
echo "NICE! All done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment