dotfiles/install.sh

133 lines
3.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
install_homebrew() {
if ! command -v brew > /dev/null; then
NONINTERACTIVE=1 /bin/bash -c "$(
curl \
--fail \
--location \
--show-error \
--silent \
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
)"
fi
}
install_shared_applications() {
brew install direnv fzf git stow the_silver_searcher tmux \
vim zsh rbenv ruby-build tfenv nodenv node-build tig libpq gnupg llvm \
2022-11-04 21:06:26 -04:00
awscli cmake jq watch gh nvim openssl@1.1 openssl@3 readline libyaml gmp
install_alacritty_terminfo
install_rust
install_vim
}
install_alacritty() {
if ! command -v alacritty > /dev/null; then
cargo install alacritty
curl \
--fail \
--location \
--output /tmp/Alacritty.svg \
https://raw.githubusercontent.com/alacritty/alacritty/master/extra/logo/alacritty-term.svg
curl \
--fail \
--location \
--output /tmp/Alacritty.desktop \
https://raw.githubusercontent.com/alacritty/alacritty/master/extra/linux/Alacritty.desktop
sudo mv /tmp/Alacritty.svg /usr/share/pixmaps/Alacritty.svg
sudo desktop-file-install /tmp/Alacritty.desktop
sudo update-desktop-database
sudo ln -s /home/$USERNAME/.cargo/bin/alacritty /usr/local/bin/alacritty
fi
}
install_alacritty_terminfo() {
if ! infocmp alacritty > /dev/null; then
curl \
--fail \
--location \
--output /tmp/alacritty.info \
https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info
sudo tic -xe alacritty,alacritty-direct /tmp/alacritty.info
$HOME/dotfiles/bin/bin/toggle-color-mode
fi
}
install_rust() {
if ! command -v rustup > /dev/null; then
curl \
--fail \
--proto '=https' \
--show-error \
--silent \
--tlsv1.2 \
https://sh.rustup.rs \
| sh -s -- -y --no-modify-path
fi
}
install_vim() {
if ! test -d ~/.local/share/nvim/site > /dev/null; then
git clone --depth 1 https://github.com/wbthomason/packer.nvim \
~/.local/share/nvim/site/pack/packer/start/packer.nvim
fi
}
install_linux() {
if ! command -v apt-get > /dev/null; then
2022-09-14 09:12:16 -04:00
echo apt-get is required, but not available
exit 1
fi
2022-09-14 09:12:16 -04:00
packages="build-essential procps curl file git cmake pkg-config\
libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev\
2022-11-04 21:06:26 -04:00
libxkbcommon-dev python3 libssl-dev xclip"
2022-09-14 09:12:16 -04:00
dpkg -s $packages >/dev/null 2>&1 \
|| sudo apt-get install --assume-yes $packages
install_homebrew
source ~/dotfiles/zsh/.zshenv
install_shared_applications
# gui
install_alacritty
}
install_darwin() {
install_homebrew
sudo mv /etc/{zprofile,zprofile.old}
source ~/dotfiles/zsh/.zshenv
install_shared_applications
softwareupdate --install-rosetta
brew install coreutils gnu-sed session-manager-plugin
# gui
brew install --cask docker rectangle slack google-chrome alacritty telegram \
discord element
}
main() {
os=$(uname | tr '[:upper:]' '[:lower:]')
case $os in
linux | darwin)
install_$os
;;
*)
echo $os not supported
exit 1
;;
esac
stow alacritty bin git nvim ruby tmux zsh
install_alacritty_terminfo
}
main