From 38a06a550b3c01e7ffff8df086ce4c577a0e5341 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 24 Oct 2023 20:47:30 -0400 Subject: [PATCH 1/5] Swap in chruby for rbenv --- install.sh | 2 +- zsh/.config/zsh/.zshrc | 6 ++---- zsh/.config/zsh/functions | 8 ++++++++ zsh/.zshenv | 2 -- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 2e1e629..5f1a74d 100755 --- a/install.sh +++ b/install.sh @@ -15,7 +15,7 @@ install_homebrew() { 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 \ + vim zsh chruby ruby-build tfenv nodenv node-build tig libpq gnupg llvm \ awscli cmake jq watch gh nvim openssl@1.1 openssl@3 readline libyaml gmp \ pyenv ripgrep diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 44e6667..bd4a2e6 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -28,10 +28,8 @@ if which direnv > /dev/null; then eval "$(direnv hook zsh)" fi -if which rbenv > /dev/null; then - eval "$(rbenv init --no-rehash -)" - (rbenv rehash &) 2> /dev/null -fi +source /home/linuxbrew/.linuxbrew/opt/chruby/share/chruby/chruby.sh +source /home/linuxbrew/.linuxbrew/opt/chruby/share/chruby/auto.sh if which nodenv > /dev/null; then eval "$(nodenv init --no-rehash -)" diff --git a/zsh/.config/zsh/functions b/zsh/.config/zsh/functions index dcdb973..ce039e9 100644 --- a/zsh/.config/zsh/functions +++ b/zsh/.config/zsh/functions @@ -80,6 +80,14 @@ function git-root { fi } +function install-ruby { + if [ $# -eq 0 ]; then + echo Usage: install-ruby RUBY_VERSION + else + ruby-build $1 $HOME/.rubies/$1 + fi +} + function password-generator { if [ -x "$(command -v openssl)" ]; then password=$( diff --git a/zsh/.zshenv b/zsh/.zshenv index 48e106f..11161c6 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -8,7 +8,6 @@ PERSONAL_BIN_PATH="$HOME/bin" PERSONAL_FPATH="$ZDOTDIR/completions" NODENV_PATH="$HOME/.nodenv/bin" -RBENV_PATH="$HOME/.rbenv/bin" TFENV_PATH="$HOME/.tfenv/bin" PYENV_PATH="$HOME/.pyenv/bin" @@ -45,7 +44,6 @@ elif [[ "$OSTYPE" == linux* ]]; then INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}"; fi -[[ -d "$RBENV_PATH" ]] && PATH="$RBENV_PATH:$PATH" [[ -d "$NODENV_PATH" ]] && PATH="$NODENV_PATH:$PATH" [[ -d "$TFENV_PATH" ]] && PATH="$TFENV_PATH:$PATH" [[ -d "$PYENV_PATH" ]] && PATH="$PYENV_PATH:$PATH" -- 2.45.2 From 96d9d331694f35ec5b0d91db0822cb2580663833 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 25 Oct 2023 19:42:26 -0400 Subject: [PATCH 2/5] Take a first pass at cleaning up install --- install.sh | 184 ++++++++++++++++++++++++++-------- packages-darwin-brew-cask.txt | 11 ++ packages-darwin-brew.txt | 4 + packages-linux-apt.txt | 14 +++ packages-shared-brew.txt | 32 ++++++ 5 files changed, 202 insertions(+), 43 deletions(-) create mode 100644 packages-darwin-brew-cask.txt create mode 100644 packages-darwin-brew.txt create mode 100644 packages-linux-apt.txt create mode 100644 packages-shared-brew.txt diff --git a/install.sh b/install.sh index 5f1a74d..77c2618 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash install_homebrew() { - if ! command -v brew > /dev/null; then + echo -n Checking homebrew... + if command -v brew > /dev/null; then + echo -n already installed... + else + echo -n installing... NONINTERACTIVE=1 /bin/bash -c "$( curl \ --fail \ @@ -11,21 +15,31 @@ install_homebrew() { https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh )" fi + echo done } -install_shared_applications() { - brew install direnv fzf git stow the_silver_searcher tmux \ - vim zsh chruby ruby-build tfenv nodenv node-build tig libpq gnupg llvm \ - awscli cmake jq watch gh nvim openssl@1.1 openssl@3 readline libyaml gmp \ - pyenv ripgrep +install_shared_brew_packages() { + echo -n Checking shared brew packages... + missing_packages=$( + comm -23 <(cat packages-shared-brew.txt) <(brew list | sort) \ + | tr "\n" " " + ) - install_fzf - install_rust - install_vim + if [[ -z $missing_packages ]]; then + echo -n already installed... + else + echo -n installing $missing_packages... + brew install $missing_packages + fi + echo done } install_alacritty() { - if ! command -v alacritty > /dev/null; then + echo -n Checking Alacritty... + if command -v alacritty > /dev/null; then + echo -n already installed... + else + echo -n installing... cargo install alacritty curl \ @@ -45,10 +59,15 @@ install_alacritty() { sudo update-desktop-database sudo ln -s /home/$USER/.cargo/bin/alacritty /usr/local/bin/alacritty fi + echo done } install_alacritty_terminfo() { - if ! infocmp alacritty > /dev/null; then + echo -n Checking Alacritty terminfo... + if infocmp alacritty > /dev/null; then + echo -n already installed... + else + echo -n installing... curl \ --fail \ --location \ @@ -57,10 +76,15 @@ install_alacritty_terminfo() { sudo tic -xe alacritty,alacritty-direct /tmp/alacritty.info fi + echo done } install_tmux_terminfo() { - if ! infocmp tmux-256color > /dev/null; then + echo -n Checking Tmux terminfo... + if infocmp tmux-256color > /dev/null; then + echo -n already installed... + else + echo -n installling.... curl \ --fail \ --location \ @@ -74,18 +98,30 @@ install_tmux_terminfo() { sudo tic -xe tmux-256color tmux-256color.src popd fi + echo done } install_fzf() { - $(brew --prefix)/opt/fzf/install \ - --xdg \ - --no-update-rc \ - --key-bindings \ - --completion + echo -n Checking fzf... + if [[ $PATH =~ "fzf" ]]; then + echo -n already installed... + else + echo -n installing... + $(brew --prefix)/opt/fzf/install \ + --xdg \ + --no-update-rc \ + --key-bindings \ + --completion + fi + echo done } install_rust() { - if ! command -v rustup > /dev/null; then + echo -n Checking Rust... + if command -v rustup > /dev/null; then + echo -n already installed... + else + echo -n installing... curl \ --fail \ --proto '=https' \ @@ -95,13 +131,83 @@ install_rust() { https://sh.rustup.rs \ | sh -s -- -y --no-modify-path fi + echo done } -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 +install_linux_packagges() { + echo -n Checking Linux packages... + packages=$(cat packages-linux-apt.txt | tr "\n" " ") + if dpkg -s $packages >/dev/null 2>&1; then + echo -n already installed... + else + echo -n installing... + sudo apt-get install --assume-yes $packages fi + echo done +} + +install_darwin_brew_packages() { + echo -n Checking Darwin brew packages... + missing_packages=$( + comm -23 <(cat packages-darwin-brew.txt) <(brew list | sort) \ + | tr "\n" " " + ) + + if [[ -z $missing_packages ]]; then + echo -n already installed... + else + echo -n installing $missing_packages... + brew install --cask $missing_packages + fi + echo done +} + +install_darwin_brew_cask_packages() { + echo -n Checking Darwin brew cask packages... + missing_packages=$( + comm -23 <(cat packages-darwin-brew-cask.txt) <(brew list | sort) \ + | tr "\n" " " + ) + + if [[ -z $missing_packages ]]; then + echo -n already installed... + else + echo -n installing $missing_packages... + brew install --cask $missing_packages + fi + echo done +} + +install_color_default() { + echo -n Checking color default file... + if [[ -f $HOME/.config/atomaka/color.yml ]]; then + echo -n already installed... + else + echo -n installing.... + $HOME/dotfiles/bin/bin/toggle-color-mode + fi + echo done +} + +install_darwin_profile_hack() { + echo -n Checking profile hack... + if [[ ! -f /etc/zprofile ]]; then + echo -n already installled... + else + echo -n installing... + sudo mv /etc/{zprofile,zprofile.old} + fi +} + +install_env() { + echo -n Checking zshenv available... + if [[ -z $HOMEBREW_PREFIX ]]; then + echo -n already installed... + else + echo -n installling... + source ~/dotfiles/zsh/.zshenv + fi + echo done } install_linux() { @@ -110,34 +216,26 @@ install_linux() { exit 1 fi - packages="build-essential procps curl file git cmake pkg-config\ - libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev\ - libxkbcommon-dev python3 libssl-dev xclip" - dpkg -s $packages >/dev/null 2>&1 \ - || sudo apt-get install --assume-yes $packages - + install_linux_packagges install_homebrew - source ~/dotfiles/zsh/.zshenv - install_shared_applications - - # gui + install_env + install_shared_brew_packages + install_fzf + install_rust install_alacritty install_alacritty_terminfo } install_darwin() { + install_darwin_profile_hack install_homebrew - [[ -f /etc/zprofile ]] && sudo mv /etc/{zprofile,zprofile.old} - source ~/dotfiles/zsh/.zshenv - install_shared_applications - + install_env + install_shared_brew_packages + install_fzf + install_rust softwareupdate --install-rosetta --agree-to-license - brew install coreutils gnu-sed session-manager-plugin orbstack - - # gui - brew install --cask rectangle slack google-chrome alacritty telegram \ - discord element brave-browser zoom notion - + install_darwin_brew_packages + install_darwin_brew_cask_packages install_tmux_terminfo } @@ -155,7 +253,7 @@ main() { stow alacritty bin git nvim ruby tmux zsh - $HOME/dotfiles/bin/bin/toggle-color-mode + install_color_default } main diff --git a/packages-darwin-brew-cask.txt b/packages-darwin-brew-cask.txt new file mode 100644 index 0000000..8652e24 --- /dev/null +++ b/packages-darwin-brew-cask.txt @@ -0,0 +1,11 @@ +alacritty +brave-browser +discord +element +firefox +google-chrome +notion +rectangle +slack +telegram +zoom diff --git a/packages-darwin-brew.txt b/packages-darwin-brew.txt new file mode 100644 index 0000000..ad062eb --- /dev/null +++ b/packages-darwin-brew.txt @@ -0,0 +1,4 @@ +coreutils +gnu-sed +orbstack +session-manager-plugin diff --git a/packages-linux-apt.txt b/packages-linux-apt.txt new file mode 100644 index 0000000..dca82ed --- /dev/null +++ b/packages-linux-apt.txt @@ -0,0 +1,14 @@ +build-essential +cmake +curl +file +git +libfontconfig1-dev +libfreetype6-dev +libssl-dev +libxcb-xfixes0-dev +libxkbcommon-dev +pkg-config +procps +python3 +xclip diff --git a/packages-shared-brew.txt b/packages-shared-brew.txt new file mode 100644 index 0000000..e9af4f0 --- /dev/null +++ b/packages-shared-brew.txt @@ -0,0 +1,32 @@ +awscli +bzip2 +chruby +cmake +direnv +fontconfig +fzf +gh +git +gmp +gnupg +jq +libpq +libyaml +llvm +neovim +node-build +nodenv +openssl@1.1 +openssl@3 +pyenv +readline +ripgrep +ruby-build +stow +tfenv +the_silver_searcher +tig +tmux +vim +watch +zsh -- 2.45.2 From 256a59daa177193f58f94335de10deb906210c78 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 25 Oct 2023 19:59:31 -0400 Subject: [PATCH 3/5] Replace everything with RTX? --- packages-shared-brew.txt | 1 + zsh/.config/zsh/.zshrc | 17 +---------------- zsh/.zshenv | 7 ------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/packages-shared-brew.txt b/packages-shared-brew.txt index e9af4f0..7bc14f4 100644 --- a/packages-shared-brew.txt +++ b/packages-shared-brew.txt @@ -21,6 +21,7 @@ openssl@3 pyenv readline ripgrep +rtx ruby-build stow tfenv diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index bd4a2e6..328090a 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -24,22 +24,7 @@ zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' setopt auto_cd -if which direnv > /dev/null; then - eval "$(direnv hook zsh)" -fi - -source /home/linuxbrew/.linuxbrew/opt/chruby/share/chruby/chruby.sh -source /home/linuxbrew/.linuxbrew/opt/chruby/share/chruby/auto.sh - -if which nodenv > /dev/null; then - eval "$(nodenv init --no-rehash -)" - (nodenv rehash &) 2> /dev/null -fi - -if which pyenv > /dev/null; then - eval "$(pyenv init --no-rehash -)" - (pyenv rehash &) 2> /dev/null -fi +eval "$(rtx activate zsh)" if [ -f $HOME/.orbstack/shell/init.zsh ]; then source $HOME/.orbstack/shell/init.zsh 2>/dev/null || : diff --git a/zsh/.zshenv b/zsh/.zshenv index 11161c6..3d606a7 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -7,10 +7,6 @@ XDG_CONFIG_HOME="$HOME/.config" PERSONAL_BIN_PATH="$HOME/bin" PERSONAL_FPATH="$ZDOTDIR/completions" -NODENV_PATH="$HOME/.nodenv/bin" -TFENV_PATH="$HOME/.tfenv/bin" -PYENV_PATH="$HOME/.pyenv/bin" - CARGO_PATH="$HOME/.cargo/bin" if [[ "$OSTYPE" == darwin* ]]; then @@ -44,9 +40,6 @@ elif [[ "$OSTYPE" == linux* ]]; then INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}"; fi -[[ -d "$NODENV_PATH" ]] && PATH="$NODENV_PATH:$PATH" -[[ -d "$TFENV_PATH" ]] && PATH="$TFENV_PATH:$PATH" -[[ -d "$PYENV_PATH" ]] && PATH="$PYENV_PATH:$PATH" [[ -d "$CARGO_PATH" ]] && PATH="$CARGO_PATH:$PATH" [[ -d "$PERSONAL_BIN_PATH" ]] && PATH="$PERSONAL_BIN_PATH:$PATH" [[ -d "$PERSONAL_FPATH" ]] && FPATH="$PERSONAL_FPATH:$FPATH" -- 2.45.2 From a344ac5e35d910e5a908324de21c17aedabf6bcd Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 10 Nov 2023 20:41:24 -0500 Subject: [PATCH 4/5] rtx / direnv setup --- zsh/.config/zsh/.zshrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 328090a..be02348 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -24,7 +24,13 @@ zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' setopt auto_cd -eval "$(rtx activate zsh)" +if which direnv > /dev/null; then + eval "$(direnv hook zsh)" +fi + +if which rtx > /dev/null; then + eval "$(rtx activate zsh)" +fi if [ -f $HOME/.orbstack/shell/init.zsh ]; then source $HOME/.orbstack/shell/init.zsh 2>/dev/null || : -- 2.45.2 From 002c363a2e50212ff09a6430cc2b2b3a31e6e7e4 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 10 Nov 2023 20:41:56 -0500 Subject: [PATCH 5/5] notes --- install-todo.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 install-todo.md diff --git a/install-todo.md b/install-todo.md new file mode 100644 index 0000000..cb3c71c --- /dev/null +++ b/install-todo.md @@ -0,0 +1,28 @@ +# installation + +## linux + +* Fail hard if no `apt-get` + +* Install linux-apt packges +* install homebrew +* source .zshenv + * how to check +* install shared-brew packages +* install alacritty +* install alacritty terminfo +* stow appropriate directories + * how to checck +* toggle color mode + +## darwin + +* install homebrew +* zprofile hack +* source .zshenv +* install shared-brew packages +* install rosetta + * how to check? +* install darwin-brew packages +* install darwin-brew-cask packages +* install tmux terminfo -- 2.45.2