Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove linuxbrew #42

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .chezmoi.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ verbose: true
diff:
# exclude:
# - scripts
pager: "diff-so-fancy | less --tabs=4 -RFX"
pager: "delta --diff-so-fancy | less --tabs=4 -RFX"

# Here we "export" the variables, so we can access them outside this file
data:
Expand Down
106 changes: 53 additions & 53 deletions .chezmoiscripts/linux/run_onchange_before_10_installs.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,71 @@

set -eufo pipefail

# if shell is interactive, prompt for sudo
if [[ $- == *i* ]]; then
sudo -v
fi

# Keep-alive: update existing `sudo` time stamp until linux installs have finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

# install linuxbrew dependencies
sudo -n apt install -y build-essential
sudo apt update

packages=(
"bat"
"fzf"
"gh"
"git"
"gpg"
"grc"
"htop"
"jq"
"less"
"nmap"
"shellcheck"
"tig"
"tldr"
"tmux"
"tree"
"universal-ctags"
"vim"
"wget"
)

# Install Linuxbrew
# HOMEBREW_INSTALL_FROM_API=1: this flag is in beta and should speed up installation
HOMEBREW_INSTALL_FROM_API=1 NONINTERACTIVE=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Loop through the array and install each package
for package in "${packages[@]}"; do
echo "Installing $package..."
sudo apt install -y $package
done

# put brew in $PATH
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# # install eza: https://github.com/eza-community/eza#debian-and-ubuntu
if [ ! -d /etc/apt/keyrings ]; then
sudo mkdir -p /etc/apt/keyrings
fi
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
sudo apt update
sudo apt install -y eza

# This install is recommended by the linuxbrew maintainers
brew install gcc
# # noninteractive rust install (needed for delta)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
# install delta
cargo install git-delta

# bash-completion caused problems for linuxbrew & was removed
{{ $brews := list
"bat"
"brew-cask-completion"
"cheat"
"chezmoi"
"ctags"
"eza"
"fzf"
"gh"
"git"
"git-delta"
"gpg"
"grc"
"htop"
"jq"
"lazygit"
"less"
"nmap"
"shellcheck"
"ssh-copy-id"
"tig"
"tmux"
"tree"
"vim"
"wget" }}
# # install lazygit
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
rm -rf "$HOME"/lazygit*

# Parrot install list
{{ if eq .osid "linux-parrot" }}

{{ $brews = list
"bat"
"chezmoi"
"ctags"
"eza"
"expect"
"fzf"
"git-delta"
"grc"
"lazygit"
"tmux"
"vim" }}
sudo apt -y install expect

{{ end }}

brew bundle --no-lock --file=/dev/stdin <<EOF
{{ range ($brews | sortAlpha | uniq) }}
brew "{{ . }}"
{{- end }}
EOF

{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ set -eufo pipefail

DOTFILES="$HOME/.local/share/chezmoi"

# put brew in $PATH
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# Set default shell to zsh
expect $DOTFILES/scripts/set_shell.expect $(cat $HOME/Desktop/my_credentials.txt | grep "Password:" | sed 's/Password: //')

Expand All @@ -26,6 +23,10 @@ alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
EOF

# Replace nvim with real vim
sudo update-alternatives --remove vim /usr/bin/nvim
sudo apt install -y vim

# Update specific packages
# sudo apt update
# sudo apt install -y codium
Expand Down
27 changes: 6 additions & 21 deletions .chezmoiscripts/run_onchange_after_100_vim.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,12 @@
#!/usr/bin/env bash
set -eufo pipefail

echo "DEBUG: starting vim plugin install script"
# Install vim-plug (https://github.com/junegunn/vim-plug/wiki/tutorial#setting-up)
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

{{ if eq .chezmoi.os "linux" }}

echo "DEBUG: Set DEBIAN_FRONTEND to noninteractive"
export DEBIAN_FRONTEND=noninteractive
echo "DEBUG: DEBIAN_FRONTEND equals $DEBIAN_FRONTEND"

# sometimes automated linux installs lose track of linuxbrew's vim
echo "DEBUG: Now putting linuxbrew in PATH"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

{{ end }}

echo "DEBUG: brew is in $(which brew)"
echo "DEBUG: vim is in $(which vim)"
echo "DEBUG: brew prefix is $(brew --prefix)"

if command -v brew > /dev/null; then
echo "DEBUG: Now installing vim plugins"
"$(brew --prefix)/bin/vim" -es -u "$HOME"/.vimrc -i NONE -c "PlugUpdate --sync" -c "qa"
fi
# NOTE: plugin install fails on pwnbox, and not even the gods know why
# See https://github.com/junegunn/vim-plug/wiki/tips#install-plugins-on-the-command-line
vim -es -u "$HOME/.vimrc" -i NONE -c "PlugInstall --sync" -c "qa"

{{- end -}}
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ DOTFILES_BRANCH=foobar /usr/bin/env bash -c "$(curl -fsSL https://raw.githubuser
### Debug Installation
Add `DOTFILES_DEBUG=true` to get debug output during the installation.

### Linux and Homebrew
For my Linux/Homebrew install script to work, the user running the dotfiles installation must be able to use `sudo` without a password. That is, the `sudoers` file should have this line:

`username ALL=(ALL) NOPASSWD: ALL`

## vim
#### Key Mappings

Expand Down
11 changes: 1 addition & 10 deletions dot_vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| endif

" ================ Load vim plugins ===================================
call plug#begin()
call plug#begin('~/.vim/plugged')

Plug 'majutsushi/tagbar'
Plug 'Lokaltog/vim-easymotion'
Expand Down Expand Up @@ -224,15 +224,6 @@ nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" ================ Abbreviations ================================

" These work in Insert Mode and are just like TextExpander Snippets.

augroup abbreviations
autocmd!
autocmd FileType * :inoreabbrev eml [email protected]
autocmd FileType * :inoreabbrev weml [email protected]
augroup END

" ================ Window Settings ==============================

Expand Down
23 changes: 10 additions & 13 deletions homebrew/homebrew.zsh
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# initialize homebrew
# macOS $HOME dir custom install
if [ -d "$HOME/homebrew" ]; then
eval "$($HOME/homebrew/bin/brew shellenv)"
# Put asdf before homebrew in $PATH when homebrew is in $HOME/homebrew
. $HOME/.asdf/asdf.sh
# linuxbrew install
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Put asdf before homebrew in $PATH on linuxbrew
. $HOME/.asdf/asdf.sh
# standard macOS install
else
eval "$(/opt/homebrew/bin/brew shellenv)"
if [[ "$(uname -s)" == "Darwin" ]]; then
# macOS $HOME dir custom install
if [ -d "$HOME/homebrew" ]; then
eval "$($HOME/homebrew/bin/brew shellenv)"
# Put asdf before homebrew in $PATH when homebrew is in $HOME/homebrew
. $HOME/.asdf/asdf.sh
# standard macOS install
else
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
fi
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ else
fi

if [ -n "${DOTFILES_DEBUG-}" ]; then
set -- "$@" --debug
set -- "$@" --debug --verbose
fi

log_task "Running 'chezmoi $*'"
Expand Down
1 change: 1 addition & 0 deletions rust/path.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export PATH="$PATH:$HOME/.cargo/bin"
Loading