Skip to content
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 git/users/wsl.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
sshCommand = ssh.exe

[gpg "ssh"]
program = "/mnt/c/Users/LeeHanbury-Pickett/AppData/Local/1Password/app/8/op-ssh-sign-wsl"
program = "/mnt/c/Users/LeeHanbury-Pickett/AppData/Local/Microsoft/WindowsApps/op-ssh-sign-wsl.exe"
13 changes: 9 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# Uncomment below line for 'debug mode'
# set -x
# Set "strict mode"
set -euo pipefail

SCRIPT_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
if [[ -f "${SCRIPT_PATH}/shell/functions" ]]; then
Expand All @@ -21,12 +21,15 @@ backup() {
}

move_link() {
backup "${1}" "${2}"
if backup "${1}" "${2}"; then
echo "${1} backed up"
fi

from="${SCRIPT_PATH}/${2}"
to="${HOME}/${1}"
new_path="$(dirname "${to}")"
mkdir -p "${new_path}"
ln -s "${from}" "${to}"
ln -sf "${from}" "${to}"
}

init_links() {
Expand Down Expand Up @@ -91,6 +94,7 @@ install_zinit() {
}

install_tpm() {
# shellcheck disable=SC2031
TMUX_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}/tmux"
TPM_PATH="${TMUX_HOME}/plugins/tpm"
if [[ -d "${TPM_PATH}" ]]; then
Expand Down Expand Up @@ -140,6 +144,7 @@ install_packages
install_tools
init_dirs
init_links

if [[ "${SHELL}" != */zsh ]]; then
chsh -s "$(which zsh)"
fi
Expand Down
84 changes: 66 additions & 18 deletions shell/functions
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ section_start() {
}

reinstall_dotfiles() {
rm -rf ~/.{local/bin,npm,nvm,zinit,go/bin,config/composer/vendor}
rm -rf ~/.{local/bin,npm,nvm,zinit,go/bin,config/composer/vendor,nvim,config/nvim}
cd ~/.dotfiles && ./setup.sh
}

Expand Down Expand Up @@ -106,6 +106,10 @@ install_arch_packages() {
}

install_wsl_packages() {
add_eza_ppa
add_php_ppa
add_gh_cli_ppa

PACKAGES=(
# Text processing
pandoc
Expand Down Expand Up @@ -135,29 +139,57 @@ install_wsl_packages() {
vim
tldr
git
gh
gpg
jq
ripgrep
exa
eza
fd-find
# git-delta
xsel
xclip
imagemagick
dnsutils
bat
zsh
)

PHP_PACKAGES=(
php8.1-bcmath
php8.1-bz2
php8.1-cli
php8.1-common
php8.1-curl
php8.1-fpm
php8.1-gd
php8.1-gmp
php8.1-intl
php8.1-mbstring
php8.1-mysql
php8.1-opcache
php8.1-readline
php8.1-soap
php8.1-tidy
php8.1-xdebug
php8.1-xml
php8.1-xsl
php8.1-zip
)

# Join PACKAGES and PHP_PACKAGES
PACKAGES=( "${PACKAGES[@]}" "${PHP_PACKAGES[@]}" )

sudo add-apt-repository ppa:longsleep/golang-backports -y

sudo apt update

# shellcheck disable=2046
sudo apt install -y "${PACKAGES[@]}"

install_rustup
install_mailpit
install_neovim
install_git_delta
# ensure fd is available
ln -s "$(which fdfind)" ~/.local/bin/fd
ln -sf "$(which fdfind)" ~/.local/bin/fd
}

setup_arch_services() {
Expand All @@ -180,30 +212,23 @@ setup_arch_services() {
}

install_nvm() {
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# shellcheck disable=SC2155
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.config/nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" && \
mkdir -p "${NVM_DIR}" && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
}

install_rustup() {
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
}

install_mailpit() {
# shellcheck disable=2024
if ! sudo bash < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh); then
echo 'Failed to install Mailpit' >&2
return 1
fi
sudo ln -s "${HOME}/.dotfiles/templates/mailpit.service" "/etc/systemd/system/mailpit.service"
sudo systemctl enable mailpit && sudo systemctl start mailpit
sudo ln -s /usr/local/bin/mailpit /usr/sbin/sendmail
}

install_neovim() {
set -x
local DIRNAME='nvim-linux-x86_64'
local FILENAME="${DIRNAME}.tar.gz"
curl -LO "https://github.com/neovim/neovim/releases/latest/download/${FILENAME}" -o "/tmp/${FILENAME}"
rm ~/.local/bin/nvim
mkdir -p ~/.local/bin
[ -e ~/.local/bin/nvim ] && rm ~/.local/bin/nvim
sudo rm -rf /opt/nvim
sudo rm -rf /opt/neovim
sudo tar -C /opt -xzf "${FILENAME}"
Expand Down Expand Up @@ -233,6 +258,7 @@ install_node_packages() {
if [[ ! -d "${NVM_DIR}" ]] || [[ ! -d "${HOME}/.nvm" ]]; then
install_nvm
fi

PACKAGES=(
@ansible/ansible-language-server
@fsouza/prettierd
Expand Down Expand Up @@ -349,3 +375,25 @@ setup_arch_system_emoji_support() {
sudo pamac install noto-fonts-emoji
sudo cp ~/.dotfiles/templates/fonts-local.conf /etc/fonts/local.conf
}

add_eza_ppa() {
sudo mkdir -p /etc/apt/keyrings
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
}

add_php_ppa() {
sudo add-apt-repository ppa:ondrej/php -y
}

add_gh_cli_ppa() {
# shellcheck disable=SC2086,SC2002
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
}
3 changes: 3 additions & 0 deletions shell/profile
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ if [ -d "/usr/local/cuda-10.0/bin/" ]; then
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi
. "$HOME/.cargo/env"

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
2 changes: 1 addition & 1 deletion shell/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ compdef __git_branch_names gpDo
# Node
export NVM_SYMLINK_CURRENT=true
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if ! type node &>/dev/null; then
nvm install --lts && nvm use --lts && nvm alias default 'lts/*'
Expand Down