dotfiles/install.sh

171 lines
5.9 KiB
Bash
Raw Normal View History

2023-05-08 16:56:15 +02:00
#!/bin/bash
# Headless
2024-01-18 00:50:30 +01:00
NVIM=true
ZSH=true
PROFILE=true
TMUX=true
2023-05-08 16:56:15 +02:00
# GUI
AWESOME=false
ALACRITTY=false
MPV=false
2023-05-17 11:40:50 +02:00
SUDO="sudo"
if [[ $(whoami) == "root" ]]; then
SUDO=""
fi
2023-05-08 16:56:15 +02:00
#################################################
# Basic Preparation #
#################################################
OS=$(grep -E '^(NAME)=' /etc/os-release )
if [[ -z "${XDG_CONFIG_HOME}" ]]; then
2024-01-18 13:15:13 +01:00
mkdir -p "$HOME"/.config
XDG_CONFIG_HOME="$HOME"/.config
2023-05-08 16:56:15 +02:00
fi
if [[ -z "${XDG_DATA_HOME}" ]]; then
2024-01-18 13:15:13 +01:00
mkdir -p "$HOME"/.local/share
XDG_DATA_HOME="$HOME"/.local/share
2023-05-08 16:56:15 +02:00
fi
#################################################
# Neovim #
#################################################
if $NVIM; then
dependencies="neovim git unzip fzf cmake gcc make curl wget ripgrep"
2023-05-08 16:56:15 +02:00
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
2024-03-06 11:22:40 +01:00
$SUDO pacman -Sy --needed --noconfirm $dependencies npm go fd dotnet-sdk
2023-05-08 16:56:15 +02:00
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
2023-05-17 11:40:50 +02:00
$SUDO apt update
$SUDO apt install -y software-properties-common
$SUDO add-apt-repository ppa:neovim-ppa/unstable -y
2023-10-19 14:32:17 +02:00
$SUDO curl -sL https://deb.nodesource.com/setup_21.x | $SUDO bash -
2024-03-15 14:21:04 +01:00
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$SUDO dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
2023-05-17 11:40:50 +02:00
$SUDO apt update
2024-03-15 14:21:04 +01:00
$SUDO apt install -y $dependencies python3-venv python3-pip nodejs golang fd-find cargo dotnet-sdk-8.0
2023-05-08 16:56:15 +02:00
fi
2024-01-18 13:15:13 +01:00
ln -s "$PWD"/nvim "$XDG_CONFIG_HOME"/nvim
ln -s "$PWD"/clang/.clang-tidy "$HOME"/.clang-tidy
2024-01-18 00:50:30 +01:00
nvim --headless "+Lazy! sync" +qa
2024-03-15 14:50:09 +01:00
nvim --headless "+MasonInstall bash-language-server pyright typescript-language-server rust-analyzer clangd cmake-language-server css-lsp dockerfile-language-server emmet-ls gopls html-lsp jdtls json-lsp ltex-ls lua-language-server ruff-lsp rustfmt rustywind texlab vetur-vls vim-language-server yaml-language-server csharp_ls typst_lsp" +qa
2024-01-18 00:50:30 +01:00
2023-05-08 16:56:15 +02:00
fi
#################################################
# ZSH #
#################################################
if $ZSH; then
PROFILE=true
2023-06-26 15:36:24 +02:00
dependencies="fzf zsh curl zoxide"
2023-05-08 16:56:15 +02:00
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
2024-03-06 11:22:40 +01:00
$SUDO pacman -Sy --needed --noconfirm $dependencies zsh-autosuggestions
2023-06-26 15:36:24 +02:00
echo "Please manually install yay"
2023-05-08 16:56:15 +02:00
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
2023-05-17 11:40:50 +02:00
$SUDO apt update
2024-03-06 11:22:40 +01:00
$SUDO apt install -y $dependencies
2023-05-08 16:56:15 +02:00
fi
2024-01-18 13:15:13 +01:00
ln -s "$PWD"/zsh "$XDG_CONFIG_HOME"/zsh
ln -s "$PWD"/zsh/.zshrc "$HOME"/.zshrc
mkdir -p "$HOME"/.local/state/zsh/
2023-05-08 16:56:15 +02:00
2023-05-17 16:53:46 +02:00
git clone https://github.com/cxreg/smartcd.git /tmp/smartcd
2024-01-18 13:15:13 +01:00
cd /tmp/smartcd || exit
2023-05-17 16:28:59 +02:00
make install
2024-01-18 13:15:13 +01:00
ln -s "$XDG_CONFIG_HOME"/zsh/.smartcd_config "$HOME"/.smartcd_config
cd - || exit
2023-05-08 16:56:15 +02:00
fi
#################################################
# Profile #
#################################################
if $PROFILE; then
2024-01-18 13:15:13 +01:00
rm -rf "$HOME"/.profile && ln -s "$PWD"/profile/.profile "$HOME"/.profile
2023-05-08 16:56:15 +02:00
fi
#################################################
# Awesome #
#################################################
if $AWESOME; then
2023-05-08 17:06:58 +02:00
dependencies="awesome picom numlockx xcape rofi"
2023-05-08 16:56:15 +02:00
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
2024-03-06 11:22:40 +01:00
$SUDO pacman -Sy --needed --noconfirm $dependencies network-manager-applet xorg-xmodmap adobe-source-code-pro-fonts noto-fonts ttf-nerd-fonts-symbols
2023-05-08 16:56:15 +02:00
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
2023-05-17 11:40:50 +02:00
$SUDO apt update
2024-03-06 11:22:40 +01:00
$SUDO apt install -y $dependencies awesome-extra
2023-05-08 16:56:15 +02:00
fi
2024-01-18 13:15:13 +01:00
ln -s "$PWD"/awesome "$XDG_CONFIG_HOME"/awesome
ln -s "$PWD"/picom/picom.conf "$XDG_CONFIG_HOME"/picom.conf
ln -s "$PWD"/xmodmap/.Xmodmap "$XDG_CONFIG_HOME"/.Xmodmap
ln -s "$PWD"/rofi "$XDG_CONFIG_HOME"/rofi
2023-05-08 16:56:15 +02:00
fi
#################################################
# Alacritty #
#################################################
if $ALACRITTY; then
dependencies="alacritty"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
2023-05-17 11:40:50 +02:00
$SUDO pacman -Sy --needed --noconfirm $dependencies
2023-05-08 16:56:15 +02:00
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
2023-05-17 11:40:50 +02:00
$SUDO apt update
$SUDO apt install -y software-properties-common
$SUDO add-apt-repository ppa:aslatter/ppa -y
$SUDO apt update
$SUDO apt install -y $dependencies
2023-05-08 16:56:15 +02:00
fi
2024-01-18 13:15:13 +01:00
ln -s "$PWD"/alacritty "$XDG_CONFIG_HOME"/alacritty
2023-05-08 16:56:15 +02:00
fi
#################################################
# MPV #
#################################################
if $MPV; then
dependencies="mpv"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
2023-05-17 11:40:50 +02:00
$SUDO pacman -Sy --needed --noconfirm $dependencies
2023-05-08 16:56:15 +02:00
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
2023-05-17 11:40:50 +02:00
$SUDO apt update
$SUDO apt install -y $dependencies
2023-05-08 16:56:15 +02:00
fi
2024-01-18 13:15:13 +01:00
ln -s "$PWD"/mpv "$XDG_CONFIG_HOME"/mpv
2023-05-08 16:56:15 +02:00
fi
#################################################
# Tmux #
#################################################
if $TMUX; then
dependencies="tmux git zsh xdg-utils"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
2024-03-06 11:22:40 +01:00
$SUDO pacman -Sy --needed --noconfirm $dependencies
2023-05-17 17:24:02 +02:00
2024-01-18 13:15:13 +01:00
ln -s "$PWD"/tmux "$XDG_CONFIG_HOME"/tmux
git clone https://github.com/tmux-plugins/tpm "$XDG_DATA_HOME"/tmux/plugins/tpm
"$XDG_DATA_HOME"/tmux/plugins/tpm/bin/install_plugins
2023-05-08 16:56:15 +02:00
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
2023-05-17 11:40:50 +02:00
$SUDO apt update
2024-03-06 11:22:40 +01:00
$SUDO apt install -y $dependencies
2023-05-08 16:56:15 +02:00
2024-01-18 13:15:13 +01:00
ln -s "$PWD"/tmux "$HOME"/.tmux
ln -s "$PWD"/tmux/tmux.conf "$HOME"/.tmux.conf
git clone https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm
"$HOME"/.tmux/plugins/tpm/bin/install_plugins
2023-05-17 17:24:02 +02:00
fi
2023-05-08 16:56:15 +02:00
fi