diff --git a/Makefile b/Makefile deleted file mode 100644 index 8ab5a17..0000000 --- a/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -STOWED = alacritty bin git ruby tmux vim zsh -UNAME = `uname` - -all: - -@make $(UNAME) install vim alacritty rust - -install: - stow $(STOWED) - - -Linux: linux_applications - -Darwin: mac_applications - /bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - sudo mv /etc/{zprofile,zprofile.old} - source ./zsh/.zshenv - - -alacritty: - curl -fLo /tmp/alacritty.info https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info - sudo tic -xe alacritty,alacritty-direct /tmp/alacritty.info - toggle-color-bin - -rust: - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path - -vim: - curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - - -mac_applications: - softwareupdate --install-rosetta - brew install coreutils gnu-sed direnv fzf git stow the_silver_searcher tmux \ - vim zsh rbenv ruby-build tfenv nodenv node-build tig libpq gnupg llvm \ - awscli cmake session-manager-plugin jq gnu-tar sccache watch gh - brew install --cask docker rectangle slack google-chrome alacritty telegram \ - discord element - -linux_applications: - sudo apt-get install direnv fzf silversearcher-ag stow tmux vim zsh - if test ! -d ~/.rbenv ; then \ - git clone https://github.com/rbenv/rbenv.git ~/.rbenv ; \ - fi - if test ! -d ~/.rbenv/plugins/ruby-build ; then \ - git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build ; \ - fi - if test ! -d ~/.nodenv ; then \ - git clone https://github.com/nodenv/nodenv.git ~/.nodenv ; \ - fi - if test ! -d ~/.nodenv/plugins/node-build ; then \ - git clone https://github.com/nodenv/node-build.git ~/.nodenv/plugins/node-build ; \ - fi - if test ! -d ~/.tfenv ; then \ - git clone https://github.com/tfutils/tfenv.git ~/.tfenv ; \ - fi diff --git a/README.md b/README.md new file mode 100644 index 0000000..3bdf98f --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# dotfiles + +Personal dotfiles managed via GNU stow. + +## Installation + +```bash +cd $HOME +git clone https://github.com/atomaka/dotfiles.git +cd dotfiles +./install.sh +``` + +## Notes + +* Some homebrew packages (ie. vim) might be missing desired features + +``` +brew uninstall PACKAGE +brew edit PACKAGE # where there is no local directory named PACKAGE +# add compile options +brew install -s PACKAGE +``` diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..7e77ad5 --- /dev/null +++ b/install.sh @@ -0,0 +1,132 @@ +#!/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 \ + awscli cmake jq watch gh + + 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 + 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 -f ~/.vim/autoload/plug.vim > /dev/null; then + curl \ + --create-dirs \ + --fail \ + --location \ + --output ~/.vim/autoload/plug.vim \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + fi +} + +install_linux() { + if ! command -v apt-get > /dev/null; then + echo apt-get is not required, but not available + exit 1 + fi + + DEBIAN_FRONTEND=noninteractive sudo apt-get install --assume-yes \ + build-essential procps curl file git cmake pkg-config libfreetype6-dev \ + libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3 + + 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 ruby tmux vim zsh +} + +main