From ae6a871336ac5bf665c1e20e2e00dfaba4f5778c Mon Sep 17 00:00:00 2001 From: Hans Goor Date: Sun, 22 Jun 2025 14:00:08 +0100 Subject: [PATCH] Removed obsolete stow configurations. Migrate to Makefile instead of install.sh. Auto install tools. --- .gitignore | 1 + .gitmodules | 3 - Makefile | 55 +++++++++ install.sh | 98 ---------------- modules/font/install.sh | 37 ------ stowers.mk | 18 +++ stowers/bash/config.sh | 3 - stowers/bash/dot-bashrc | 44 ------- stowers/fastfetch/config.sh | 3 - stowers/fastfetch/dot-config/fastfetch.json | 25 ---- .../dot-config/fish/conf.d/99-fastfetch.fish | 3 - stowers/fastfetch/dot-zshrc.d/99-fastfetch.sh | 5 - stowers/fish/config.sh | 3 - stowers/git/config.sh | 16 --- stowers/nvim/config.sh | 3 - stowers/shell-utils/config.sh | 3 - stowers/shell-utils/dot-local/bin/_cdp_path | 29 ----- stowers/shell-utils/dot-local/bin/clone | 19 +-- stowers/shell-utils/dot-local/bin/devc-ssh | 43 ------- stowers/shell-utils/dot-local/bin/pp | 27 +++++ stowers/shell-utils/dot-local/bin/toolbx | 110 ------------------ .../shell-utils/toolbx/container_autoshell.sh | 33 ------ .../shell-utils/toolbx/container_setup.sh | 48 -------- stowers/ssh/config.sh | 3 - stowers/tmux/config.sh | 3 - stowers/tmux/dot-tmux.conf | 21 ---- stowers/tmux/dot-tmux/.gitignore | 2 - stowers/tmux/dot-tmux/bindings.conf | 17 --- stowers/tmux/dot-tmux/gitmux.conf | 85 -------------- stowers/tmux/dot-tmux/globals.conf | 4 - stowers/tmux/dot-tmux/nvim.conf | 29 ----- .../dot-tmux/plugin-configs/rose-pine.conf | 14 --- stowers/tmux/dot-tmux/plugins/tpm | 1 - stowers/wezterm/config.sh | 3 - stowers/zsh/config.sh | 3 - tools.mk | 12 ++ tools/nvim.mk | 18 +++ tools/starship.mk | 12 ++ tools/stow.mk | 19 +++ 39 files changed, 172 insertions(+), 703 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile delete mode 100755 install.sh delete mode 100755 modules/font/install.sh create mode 100644 stowers.mk delete mode 100644 stowers/bash/config.sh delete mode 100644 stowers/bash/dot-bashrc delete mode 100644 stowers/fastfetch/config.sh delete mode 100644 stowers/fastfetch/dot-config/fastfetch.json delete mode 100644 stowers/fastfetch/dot-config/fish/conf.d/99-fastfetch.fish delete mode 100644 stowers/fastfetch/dot-zshrc.d/99-fastfetch.sh delete mode 100644 stowers/fish/config.sh delete mode 100644 stowers/git/config.sh delete mode 100644 stowers/nvim/config.sh delete mode 100644 stowers/shell-utils/config.sh delete mode 100755 stowers/shell-utils/dot-local/bin/_cdp_path delete mode 100755 stowers/shell-utils/dot-local/bin/devc-ssh create mode 100755 stowers/shell-utils/dot-local/bin/pp delete mode 100755 stowers/shell-utils/dot-local/bin/toolbx delete mode 100755 stowers/shell-utils/dot-local/share/eyedevelop/shell-utils/toolbx/container_autoshell.sh delete mode 100755 stowers/shell-utils/dot-local/share/eyedevelop/shell-utils/toolbx/container_setup.sh delete mode 100644 stowers/ssh/config.sh delete mode 100644 stowers/tmux/config.sh delete mode 100644 stowers/tmux/dot-tmux.conf delete mode 100644 stowers/tmux/dot-tmux/.gitignore delete mode 100644 stowers/tmux/dot-tmux/bindings.conf delete mode 100644 stowers/tmux/dot-tmux/gitmux.conf delete mode 100644 stowers/tmux/dot-tmux/globals.conf delete mode 100644 stowers/tmux/dot-tmux/nvim.conf delete mode 100644 stowers/tmux/dot-tmux/plugin-configs/rose-pine.conf delete mode 160000 stowers/tmux/dot-tmux/plugins/tpm delete mode 100644 stowers/wezterm/config.sh delete mode 100644 stowers/zsh/config.sh create mode 100644 tools.mk create mode 100644 tools/nvim.mk create mode 100644 tools/starship.mk create mode 100644 tools/stow.mk diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/.gitmodules b/.gitmodules index 1a37c86..68d63e8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "tmux/dot-tmux/plugins/tpm"] - path = stowers/tmux/dot-tmux/plugins/tpm - url = https://github.com/tmux-plugins/tpm [submodule "zsh/dot-oh-my-zsh"] path = stowers/zsh/dot-oh-my-zsh url = https://github.com/ohmyzsh/ohmyzsh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9d85b29 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +.PHONY = clean install offline fonts/all fonts/download-all uninstall +default: install + +LOCAL_CACHE ?= ./build/cache +LOCAL_TOOLS ?= ./build/tools +LOCAL_FONTS ?= $(HOME)/.local/share/fonts +FONTS_TO_INSTALL ?= FiraCode FiraMono Hack +LOCAL_TOOLS_BIN ?= $(HOME)/.local/bin +STOW_TARGET ?= $(HOME) + +STOW := $(shell command -v stow 2>/dev/null) + +# Compile stow if it doesn't exist +ifeq ($(STOW),) +STOW := $(LOCAL_TOOLS_BIN)/stow +BUILD_STOW := 1 + +PERL5LIB := $(LOCAL_TOOLS)/stow/lib +export PERL5LIB +endif + +## Includes +include tools.mk +include stowers.mk + +install: tools/all stowers/all fonts/all + +offline: tools/download-all fonts/download-all + +clean: tools/clean + rm -rf ./build + +uninstall: stowers/uninstall/all clean + @echo Uninstalled! + +$(LOCAL_CACHE) $(LOCAL_CACHE)/fonts $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN): + mkdir -p $@ + +$(LOCAL_CACHE)/fonts/%.tar.xz: $(LOCAL_CACHE)/fonts + @echo Downloading font $* + curl -o $@ -L https://github.com/ryanoasis/nerd-fonts/releases/latest/download/$*.tar.xz + +fonts/download-all: $(foreach font,$(FONTS_TO_INSTALL),$(LOCAL_CACHE)/fonts/$(font).tar.xz) + @echo Downloaded all fonts + +fonts/all: $(foreach font,$(FONTS_TO_INSTALL),fonts/$(font)) + @echo Installed all fonts + +fonts/%: $(LOCAL_CACHE)/fonts/%.tar.xz + @echo Installing font $* + mkdir -p $(LOCAL_FONTS) + mkdir -p $(LOCAL_CACHE)/fonts/$* + tar -C $(LOCAL_CACHE)/fonts/$* -xJf $< + find $(LOCAL_CACHE)/fonts/$* -type f \( -iname '*.otf' -o -iname '*.ttf' \) -exec mv {} $(LOCAL_FONTS)/ \; + fc-cache -f diff --git a/install.sh b/install.sh deleted file mode 100755 index 22e79ba..0000000 --- a/install.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -DOTFILES_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -STOWERS_DIR="${DOTFILES_DIR}/stowers" -MODULES_DIR="${DOTFILES_DIR}/modules" -TARGET_DIR="${HOME}" - -install_stower() { - if ! command -v stow &>/dev/null; then - echo "[!] GNU Stow is not installed!" >&2 - return 1 - fi - - if [[ "$#" -lt 1 ]]; then - echo "[!] No stower given!" >&2 - return 1 - fi - - local stower_name stower_dir - stower_name="$1" - stower_dir="${STOWERS_DIR}/${stower_name}" - - if [[ ! -d "${stower_dir}" ]]; then - echo "[!] Stower (${stower_dir}) is not a directory!" >&2 - return 1 - fi - - local COMMAND_DEPS - COMMAND_DEPS=() - if [[ -f "${stower_dir}"/config.sh ]]; then - source "${stower_dir}"/config.sh - fi - - for required_cmd in "${COMMAND_DEPS[@]}"; do - if ! command -v "${required_cmd}" &>/dev/null; then - echo "[${stower_name}] Missing required command: ${required_cmd}" >&2 - return 1 - fi - done - - stow --dotfiles \ - --dir "${STOWERS_DIR}" \ - --target "${TARGET_DIR}" \ - --ignore "config.sh" "${stower_name}" || \ - { [[ "$(type -t fallback)" == "function" ]] && fallback "${stower_dir}" "${TARGET_DIR}"; } || \ - { echo "[!] [${stower_name}] Failed to install!" >&2; return 1; } - - echo "[+] [${stower_name}] Installed!" -} - -install_module() { - if [[ "$#" -lt 1 ]]; then - echo "[!] No module given!" >&2 - return 1 - fi - - local module_dir - module_dir="${MODULES_DIR}/$1" - - if [[ ! -d "${module_dir}" ]] || [[ ! -f "${module_dir}/install.sh" ]]; then - echo "[!] Module (${module_dir}) is not a module!" >&2 - return 1 - fi - - /bin/bash "${module_dir}/install.sh" -} - -STOWERS=() -MODULES=() -if [[ "$#" -gt 0 ]]; then - for stower_or_module in "$@"; do - if [[ -e "${STOWERS_DIR}/${stower_or_module}" ]]; then - STOWERS+=("${stower_or_module}") - elif [[ -e "${MODULES_DIR}/${stower_or_module}" ]]; then - MODULES+=("${stower_or_module}") - else - echo "[!] No such stower/module: ${stower_or_module}" >&2 - return 1 - fi - done -else - for stower in "${STOWERS_DIR}"/*/; do - stower_name="$(basename -- "${stower}")" - STOWERS+=("${stower_name}") - done -fi - -for stower in "${STOWERS[@]}"; do - install_stower "${stower}" || true -done - -for module in "${MODULES[@]}"; do - install_module "${module}" || true -done - -echo "[+] Installed everything!" diff --git a/modules/font/install.sh b/modules/font/install.sh deleted file mode 100755 index 2a17573..0000000 --- a/modules/font/install.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -get_latest_nerd_font_release() { - basename "$(curl -Ls -o /dev/null -w "%{url_effective}" https://github.com/ryanoasis/nerd-fonts/releases/latest)" -} - -install_font() { - if [[ "$#" -lt 1 ]]; then - echo "[!] No font file given to download!" >&2 - return 1 - fi - - local latest_release font_name - font_name="$1" - latest_release="$(get_latest_nerd_font_release)" - tmpdir="$(mktemp -d)" - - curl -Lo "${tmpdir}/${font_name}" "https://github.com/ryanoasis/nerd-fonts/releases/download/${latest_release}/${font_name}" - mkdir "${tmpdir}/font_files" - tar -C "${tmpdir}/font_files" -xJf "${tmpdir}/${font_name}" - - mkdir -p "${HOME}/.local/share/fonts" - find "${tmpdir}/font_files" -type f \( -iname '*.otf' -o -iname '*.ttf' \) -exec mv {} "${HOME}/.local/share/fonts/" \; - - rm -rf "${tmpdir}" -} - -for font in "FiraCode.tar.xz" "Hack.tar.xz" "FiraMono.tar.xz"; do - echo "[+] Installing ${font}..." - install_font "${font}" -done - -echo "[+] Reloading font cache..." -fc-cache -f - diff --git a/stowers.mk b/stowers.mk new file mode 100644 index 0000000..7370fa4 --- /dev/null +++ b/stowers.mk @@ -0,0 +1,18 @@ +STOWERS := $(wildcard stowers/*) +STOW_TARGET ?= $(HOME) + +.PHONY = stowers/all $(STOWERS) + +stowers/all: $(STOWERS) + @echo Installed all + +stowers/uninstall/all: $(foreach stower,$(STOWERS),$(patsubst stowers/%,stowers/uninstall/%,$(stower))) + @echo Uninstalled all + +stowers/uninstall/%: $(STOW) + @echo Unstowing $* + $(STOW) --delete --dir stowers/ --target $(STOW_TARGET) --dotfiles $* + +stowers/%: $(STOW) + @echo Stowing $* + test -d $@ && $(STOW) --stow --dir stowers/ --target $(STOW_TARGET) --dotfiles $* diff --git a/stowers/bash/config.sh b/stowers/bash/config.sh deleted file mode 100644 index 5ba72b4..0000000 --- a/stowers/bash/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("bash") diff --git a/stowers/bash/dot-bashrc b/stowers/bash/dot-bashrc deleted file mode 100644 index ef9a43a..0000000 --- a/stowers/bash/dot-bashrc +++ /dev/null @@ -1,44 +0,0 @@ -# .bashrc - -# Source global definitions -if [ -f /etc/bashrc ]; then - . /etc/bashrc -fi - -# User specific environment -if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]] -then - PATH="$HOME/.local/bin:$HOME/bin:$PATH" -fi -export PATH - -# Uncomment the following line if you don't like systemctl's auto-paging feature: -# export SYSTEMD_PAGER= - -# User specific aliases and functions -if [ -d ~/.bashrc.d ]; then - for rc in ~/.bashrc.d/*; do - if [ -f "$rc" ]; then - . "$rc" - fi - done -fi - -unset rc - -# Auto start tmux -if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ] && [ -z "$SSH_CONNECTION" ]; then - exec tmux -fi - -# Aliases -WORKSPACE_DIR="${HOME}/spaces/workspace" -export WORKSPACE_DIR - -alias vi="nvim" -alias vim="nvim" -alias cdw="cd -- ${WORKSPACE_DIR}" - -function cdp() { - cd -- "$(_cdp_path "$@")" -} diff --git a/stowers/fastfetch/config.sh b/stowers/fastfetch/config.sh deleted file mode 100644 index 451848f..0000000 --- a/stowers/fastfetch/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("fastfetch") diff --git a/stowers/fastfetch/dot-config/fastfetch.json b/stowers/fastfetch/dot-config/fastfetch.json deleted file mode 100644 index c73adca..0000000 --- a/stowers/fastfetch/dot-config/fastfetch.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", - "logo": { - "source": "opensuse", - "type": "small" - }, - "modules": [ - "title", - "separator", - "host", - "uptime", - "shell", - "break", - "cpu", - "gpu", - "memory", - "disk", - "break", - "localip", - { - "type": "publicip", - "url": "http://ip.eyedevelop.org" - } - ] -} diff --git a/stowers/fastfetch/dot-config/fish/conf.d/99-fastfetch.fish b/stowers/fastfetch/dot-config/fish/conf.d/99-fastfetch.fish deleted file mode 100644 index a1e3f90..0000000 --- a/stowers/fastfetch/dot-config/fish/conf.d/99-fastfetch.fish +++ /dev/null @@ -1,3 +0,0 @@ -if status --is-interactive; and test -f /etc/os-release - fastfetch --logo (grep -Ee '^ID=' /etc/os-release | sed 's,ID="\(.*\)-.*",\1,g') -c ~/.config/fastfetch.json -end diff --git a/stowers/fastfetch/dot-zshrc.d/99-fastfetch.sh b/stowers/fastfetch/dot-zshrc.d/99-fastfetch.sh deleted file mode 100644 index ea1df64..0000000 --- a/stowers/fastfetch/dot-zshrc.d/99-fastfetch.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -[[ -n "$PS1" ]] && [[ -f /etc/os-release ]] && \ - fastfetch --logo "$(grep -Ee '^ID=' /etc/os-release | sed 's,ID="\(.*\)-.*",\1,g')" -c ~/.config/fastfetch.json - diff --git a/stowers/fish/config.sh b/stowers/fish/config.sh deleted file mode 100644 index 19c3cb5..0000000 --- a/stowers/fish/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("fish") diff --git a/stowers/git/config.sh b/stowers/git/config.sh deleted file mode 100644 index 2fe01b8..0000000 --- a/stowers/git/config.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("git") - -fallback() { - local stower_dir target_dir - stower_dir="$1" - target_dir="$2" - - git config --global user.name "Hans Goor" - git config --global user.email "me@eyedevelop.org" - git config --global commit.gpgSign true - git config --global push.autoSetupRemote true - git config --global init.defaultBranch main - git config --global pull.rebase true -} diff --git a/stowers/nvim/config.sh b/stowers/nvim/config.sh deleted file mode 100644 index 2b7de01..0000000 --- a/stowers/nvim/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("nvim") diff --git a/stowers/shell-utils/config.sh b/stowers/shell-utils/config.sh deleted file mode 100644 index 5ba72b4..0000000 --- a/stowers/shell-utils/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("bash") diff --git a/stowers/shell-utils/dot-local/bin/_cdp_path b/stowers/shell-utils/dot-local/bin/_cdp_path deleted file mode 100755 index 7263049..0000000 --- a/stowers/shell-utils/dot-local/bin/_cdp_path +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -function _get_projects() { - ( cd -- "${WORKSPACE_DIR}" && find . -mindepth 3 -maxdepth 3 -type d | sed 's|^\./||' ) -} - -function _cdp() { - if command -v fzf &>/dev/null; then - echo "${WORKSPACE_DIR}/$(_get_projects | fzf --query "$*")" - return - fi - - readarray -t projects <<< "$(_get_projects)" - local filtered_projects - filtered_projects=() - - for project in "${projects[@]}"; do - if [[ "${project}" == "$1"* ]]; then - filtered_projects+=("${project}") - fi - done - - select project in "${filtered_projects[@]}"; do - echo "${WORKSPACE_DIR}/${project}" - break - done -} - -_cdp "$@" diff --git a/stowers/shell-utils/dot-local/bin/clone b/stowers/shell-utils/dot-local/bin/clone index 9535643..4012d1d 100755 --- a/stowers/shell-utils/dot-local/bin/clone +++ b/stowers/shell-utils/dot-local/bin/clone @@ -8,15 +8,15 @@ function _clone() { local url="$1" local forge owner repo - if [[ "${url}" =~ ^ssh:\/\/[a-zA-Z0-9_\-]+@([a-zA-Z0-9_.\-]+):[0-9]+/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then - forge="${BASH_REMATCH[1],,}" - owner="${BASH_REMATCH[2],,}" - repo="${BASH_REMATCH[3],,}" - elif [[ "${url}" =~ ^[a-zA-Z0-9_\-]+@([a-zA-Z0-9_.\-]+):([a-zA-Z0-9_\-]+)\/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then - forge="${BASH_REMATCH[1],,}" - owner="${BASH_REMATCH[2],,}" - repo="${BASH_REMATCH[3],,}" - elif [[ "${url}" =~ ^https?:\/\/([a-zA-Z0-9_.\-]+)(:[0-9]+)?\/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then + if [[ "${url}" =~ ^ssh:\/\/([a-zA-Z0-9_\-]+@)?([a-zA-Z0-9_.\-]+)(:[0-9]+)?\/([a-zA-Z0-9_\-\/]+)\/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then + forge="${BASH_REMATCH[2],,}" + owner="${BASH_REMATCH[4],,}" + repo="${BASH_REMATCH[5],,}" + elif [[ "${url}" =~ ^([a-zA-Z0-9_\-]+@)?([a-zA-Z0-9_.\-]+):([a-zA-Z0-9_\-\/]+)\/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then + forge="${BASH_REMATCH[2],,}" + owner="${BASH_REMATCH[3],,}" + repo="${BASH_REMATCH[4],,}" + elif [[ "${url}" =~ ^https?:\/\/([a-zA-Z0-9_.\-]+)(:[0-9]+)?\/([a-zA-Z0-9_\-\/]+)/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then forge="${BASH_REMATCH[1],,}" owner="${BASH_REMATCH[3],,}" repo="${BASH_REMATCH[4],,}" @@ -25,6 +25,7 @@ function _clone() { return 1 fi + mkdir -p "${WORKSPACE_DIR}/${forge}/${owner}" git clone "${url}" "${WORKSPACE_DIR}/${forge}/${owner}/${repo}" } diff --git a/stowers/shell-utils/dot-local/bin/devc-ssh b/stowers/shell-utils/dot-local/bin/devc-ssh deleted file mode 100755 index 20be158..0000000 --- a/stowers/shell-utils/dot-local/bin/devc-ssh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -CONTAINER="docker" -if ! command -v docker &>/dev/null; then - CONTAINER="podman" -fi - -if [[ "$#" -lt 1 ]]; then - echo "Usage: $0 " >&2 - exit 1 -fi - -container_id="$1"; shift - -# We expect a devcontainer to run an SSH server on 2222/tcp -# and to have this port exposed. We find the host binding -# to SSH to that container. - -if ! ssh_port="$(${CONTAINER} inspect --format '{{ (index (index .NetworkSettings.Ports "2222/tcp") 0).HostPort }}' "${container_id}" 2>/dev/null)"; then - echo "[!] Could not get SSH host port for container '${container_id}'" >&2 - exit 1 -fi - -ignore_hostkey=("-oUserKnownHostsFile=/dev/null" "-oStrictHostKeyChecking=false") - -if ! ssh "${ignore_hostkey[@]}" -oPasswordAuthentication=no -p "${ssh_port}" -T dev@localhost 'exit'; then - docker exec -it "${container_id}" /bin/bash -c 'echo "dev:dev" | chpasswd' - echo "[+] Changed password of container user to 'dev'" - - if command -v sshpass &>/dev/null; then - sshpass -p"dev" ssh-copy-id -p "${ssh_port}" dev@localhost - elif command -v expect &>/dev/null; then - expect -c "spawn $(which ssh-copy-id) -p ${ssh_port} dev@localhost; interact -o -nobuffer -re .*assword.* return; send \"dev\r\n\"; send -- \"\r\"; expect eof;" - else - echo "[?] Could not find application to automatically copy SSH key." - echo " Please enter the password 'dev' manually below." - ssh-copy-id -p "${ssh_port}" dev@localhost - fi -fi - -ssh "${ignore_hostkey[@]}" \ - -p "${ssh_port}" \ - dev@localhost "$@" diff --git a/stowers/shell-utils/dot-local/bin/pp b/stowers/shell-utils/dot-local/bin/pp new file mode 100755 index 0000000..f6b231e --- /dev/null +++ b/stowers/shell-utils/dot-local/bin/pp @@ -0,0 +1,27 @@ +#!/bin/bash + +set -euo pipefail + +function _get_projects() { + find "${WORKSPACE_DIR?}" -type d -iname ".git" | sed "s|${WORKSPACE_DIR?}/\(.*\)/.git|\1|g" +} + +function _pp() { + if command -v fzf &>/dev/null; then + _get_projects | fzf --select-1 --query "$1" + return + fi + + select project in $(_get_projects); do + echo "${project}" + done +} + +function _pp_comp() { + _init_completion || return + local cur prev words cword + + COMPREPLY=( compgen -W "$(_get_projects)" -- "${cur}" ) +} && complete -F _pp_comp pp cdp + +_pp "$*" diff --git a/stowers/shell-utils/dot-local/bin/toolbx b/stowers/shell-utils/dot-local/bin/toolbx deleted file mode 100755 index d2b155b..0000000 --- a/stowers/shell-utils/dot-local/bin/toolbx +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -TOOLBX_NAME="toolbx" -LIB_HOME="${HOME}/.local/share/eyedevelop/shell-utils/toolbx" - -delete_toolbox() { - podman rm -f "${TOOLBX_NAME}" -} - -create_toolbox() { - local image podman_args - image="debian:bookworm" - podman_args=( - "--name=${TOOLBX_NAME}" - "--hostuser=${USER}" - "--env=_REAL_USER=${USER}" - "--userns=keep-id" - "--security-opt=label=disable" - "--network=host" - "--hostname=toolbox" - "--volume=${HOME}:/home/${USER}" - "--user=root" - "--entrypoint=/entrypoint.sh" - ) - - while [[ "$#" -ge 1 ]]; do - case "$1" in - -i|--image) - image="$2" - shift - shift - ;; - - -p|--privileged) - podman_args+=("--privileged") - shift - ;; - esac - done - - podman_args+=("$image") - - if podman container exists toolbx; then - echo "[!] Toolbx container already exists. Want to replace?" - echo -n "(Y/n) > " - read -r opt - - if [[ "${opt,,}" == "n" ]]; then - echo "[!] Aborting." - return 1 - fi - - delete_toolbox - fi - - podman create "${podman_args[@]}" >/dev/null - podman cp "${LIB_HOME}/container_setup.sh" "${TOOLBX_NAME}":/entrypoint.sh >/dev/null - podman cp "${LIB_HOME}/container_autoshell.sh" "${TOOLBX_NAME}":/autoshell.sh &>/dev/null - podman start "${TOOLBX_NAME}" >/dev/null - - echo "[+] Created!" -} - -enter_toolbox() { - if ! podman container exists "${TOOLBX_NAME}"; then - create_toolbox - fi - - podman exec -it --env=_REAL_USER="${USER}" "${TOOLBX_NAME}" "/autoshell.sh" "${SHELL}" -} - -print_usage() { - echo "--- Primitive container-based toolbox utility ---" - echo "Usage: $0 " - echo "Commands:" - echo " enter -- Enter the toolbox." - echo " create [opts] [command...] -- Create a new toolbox." - echo " -i|--image -- The image to use to create the toolbox with." - echo " -p|--privileged -- Whether the toolbox is privileged or not." - echo " delete -- Delete the current toolbox." -} - -if [[ "$#" -lt 1 ]]; then - print_usage - exit 1 -fi - -while [[ "$#" -ge 1 ]]; do - COMMAND="$1"; shift - - case "${COMMAND}" in - enter) - enter_toolbox "$@" - ;; - - create) - create_toolbox "$@" - ;; - - delete) - delete_toolbox "$@" - ;; - - *) - enter_toolbox "$@" - ;; - esac -done diff --git a/stowers/shell-utils/dot-local/share/eyedevelop/shell-utils/toolbx/container_autoshell.sh b/stowers/shell-utils/dot-local/share/eyedevelop/shell-utils/toolbx/container_autoshell.sh deleted file mode 100755 index e7ae478..0000000 --- a/stowers/shell-utils/dot-local/share/eyedevelop/shell-utils/toolbx/container_autoshell.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -REAL_SHELL="$1" - -install_shell() { - source /etc/os-release - - case "${ID}" in - debian) - apt-get -y update && apt-get -y install "$(apt-file update &>/dev/null && apt-file search -lF "${REAL_SHELL}" | head -n1 )" - ;; - - *) - echo "[!] Unsupported distro: ${NAME}" >&2 - return 1 - esac -} - -start_shell() { - if command -v "${REAL_SHELL}" &>/dev/null; then - exec su -s "${REAL_SHELL}" - "${_REAL_USER}" - else - exec su -s "/bin/bash" - "${_REAL_USER}" - fi -} - -if ! command -v "${REAL_SHELL}" &>/dev/null; then - install_shell >/dev/null || true -fi - -start_shell "$@" diff --git a/stowers/shell-utils/dot-local/share/eyedevelop/shell-utils/toolbx/container_setup.sh b/stowers/shell-utils/dot-local/share/eyedevelop/shell-utils/toolbx/container_setup.sh deleted file mode 100755 index 73cbda0..0000000 --- a/stowers/shell-utils/dot-local/share/eyedevelop/shell-utils/toolbx/container_setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -trap 'exit 0' SIGTERM SIGINT - -if [[ "$#" -gt 1 ]] && [[ "$1" == /autoshell.sh ]]; then - exec /autoshell.sh "$@" -fi - -install_deps() { - if [[ -f /.pkg-installed ]]; then - return 0 - fi - - if [[ ! -f /etc/os-release ]]; then - echo "[!] Unsupported container image!" >&2 - return 1 - fi - - source /etc/os-release - case "${ID}" in - debian) - apt-get -y update && apt-get -y install \ - sudo iproute2 man bash-completion net-tools git passwd util-linux apt-utils apt-file - ;; - - *) - echo "[!] Unsupported distro: ${NAME}" >&2 - return 1 - esac - - touch /.pkg-installed -} - -create_user() { - echo "${_REAL_USER} ALL=(root) NOPASSWD: ALL" > /etc/sudoers.d/toolbx -} - -install_deps -create_user - -echo "127.0.1.1 $(hostname -f) $(hostname)" >> /etc/hosts -echo "[!] Done with setup!" - -while true; do - sleep 86400 -done diff --git a/stowers/ssh/config.sh b/stowers/ssh/config.sh deleted file mode 100644 index b411535..0000000 --- a/stowers/ssh/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("ssh") diff --git a/stowers/tmux/config.sh b/stowers/tmux/config.sh deleted file mode 100644 index d390d51..0000000 --- a/stowers/tmux/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("tmux") diff --git a/stowers/tmux/dot-tmux.conf b/stowers/tmux/dot-tmux.conf deleted file mode 100644 index 2e09a62..0000000 --- a/stowers/tmux/dot-tmux.conf +++ /dev/null @@ -1,21 +0,0 @@ -set -g mouse on - -# Plugins -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'rose-pine/tmux' -set -g @plugin 'ofirgall/tmux-window-name' - -# Plugin config -source $HOME/.tmux/plugin-configs/rose-pine.conf - -# General config -source $HOME/.tmux/globals.conf - -# Nvim helper -source $HOME/.tmux/nvim.conf - -# Keybindings -source $HOME/.tmux/bindings.conf - -# Initialise tmux plugin manager. -run $HOME/.tmux/plugins/tpm/tpm diff --git a/stowers/tmux/dot-tmux/.gitignore b/stowers/tmux/dot-tmux/.gitignore deleted file mode 100644 index 9761a4b..0000000 --- a/stowers/tmux/dot-tmux/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -plugins/* -!plugins/tpm diff --git a/stowers/tmux/dot-tmux/bindings.conf b/stowers/tmux/dot-tmux/bindings.conf deleted file mode 100644 index f32cb9d..0000000 --- a/stowers/tmux/dot-tmux/bindings.conf +++ /dev/null @@ -1,17 +0,0 @@ -set -g mouse on - -# Open new windows with the same directory -unbind c -bind c new-window -c "#{pane_current_path}" - -# Binds -unbind '"' -unbind % -bind | split-window -h -c "#{pane_current_path}" -bind - split-window -v -c "#{pane_current_path}" - -# Alt-arrow switching -# bind -n M-Left select-pane -L -# bind -n M-Right select-pane -R -# bind -n M-Up select-pane -U -# bind -n M-Down select-pane -D diff --git a/stowers/tmux/dot-tmux/gitmux.conf b/stowers/tmux/dot-tmux/gitmux.conf deleted file mode 100644 index 4e8e059..0000000 --- a/stowers/tmux/dot-tmux/gitmux.conf +++ /dev/null @@ -1,85 +0,0 @@ -tmux: - # The symbols section defines the symbols printed before specific elements - # of Git status displayed in tmux status string. - symbols: - # current branch name. - branch: "⎇ " - # Git SHA1 hash (in 'detached' state). - hashprefix: ":" - # 'ahead count' when local and remote branch diverged. - ahead: ↑· - # 'behind count' when local and remote branch diverged. - behind: ↓· - # count of files in the staging area. - staged: "● " - # count of files in conflicts. - conflict: "✖ " - # count of modified files. - modified: "✚ " - # count of untracked files. - untracked: "… " - # count of stash entries. - stashed: "⚑ " - # count of inserted lines (stats section). - insertions: Σ - # count of deleted lines (stats section). - deletions: Δ - # Shown when the working tree is clean. - clean: ✔ - - # Styles are tmux format strings used to specify text colors and attributes - # of Git status elements. See the STYLES section of tmux man page. - # https://man7.org/linux/man-pages/man1/tmux.1.html#STYLES. - styles: - # Clear previous style. - clear: "#[none]" - # Special tree state strings such as [rebase], [merge], etc. - state: "#[fg=red,bold]" - # Local branch name - branch: "#[fg=white,bold]" - # Remote branch name - remote: "#[fg=cyan]" - # 'divergence' counts - divergence: "#[fg=yellow]" - # 'staged' count - staged: "#[fg=green,bold]" - # 'conflicts' count - conflict: "#[fg=red,bold]" - # 'modified' count - modified: "#[fg=red,bold]" - # 'untracked' count - untracked: "#[fg=magenta,bold]" - # 'stash' count - stashed: "#[fg=cyan,bold]" - # 'insertions' count - insertions: "#[fg=green]" - # 'deletions' count - deletions: "#[fg=red]" - # 'clean' symbol - clean: "#[fg=green,bold]" - - # The layout section defines what components gitmux shows and the order in - # which they appear on tmux status bar. - # - # Allowed components: - # - branch: local branch name. Examples: `⎇ main`, `⎇ :345e7a0` or `[rebase]` - # - remote-branch: remote branch name, for example: `origin/main`. - # - divergence: divergence between local and remote branch, if any. Example: `↓·2↑·1` - # - remote: alias for `remote-branch` followed by `divergence`, for example: `origin/main ↓·2↑·1` - # - flags: symbols representing the working tree state, for example `✚ 1 ⚑ 1 … 2` - # - stats: insertions/deletions (lines), for example`Σ56 Δ21` - # - some string `foo`: any other character of string is directly shown, for example `foo` or `|` - layout: [branch, remote-branch, divergence, " - ", flags] - - # Additional configuration options. - options: - # Maximum displayed length for local and remote branch names. - branch_max_len: 0 - # Trim left or right end of the branch (`right` or `left`). - branch_trim: right - # Character indicating whether and where a branch was truncated. - ellipsis: … - # Hides the clean flag - hide_clean: false - # Swaps order of behind & ahead upstream counts - "↓·1↑·1" -> "↑·1↓·1" - swap_divergence: false diff --git a/stowers/tmux/dot-tmux/globals.conf b/stowers/tmux/dot-tmux/globals.conf deleted file mode 100644 index 704ed49..0000000 --- a/stowers/tmux/dot-tmux/globals.conf +++ /dev/null @@ -1,4 +0,0 @@ -set -g status-interval 2 -set -g default-command "${SHELL}" -set -g update-environment "PATH" -set -g history-limit 10000 diff --git a/stowers/tmux/dot-tmux/nvim.conf b/stowers/tmux/dot-tmux/nvim.conf deleted file mode 100644 index e759de7..0000000 --- a/stowers/tmux/dot-tmux/nvim.conf +++ /dev/null @@ -1,29 +0,0 @@ -# helper to decide whether we are inside (n)vim -is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ - | grep -iqE '^[^TXZ ]+ +(\\$+\\/)?g?(view|n?vim?x?)(diff)?$'" - -# Correct binding depending on version -if-shell -b '[[ "$(tmux -V)" == tmux\ 2.* ]]' \ - "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" -if-shell -b '[[ "$(tmux -V)" == tmux\ 3.* ]]' \ - "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" - -# Bindings -bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+' - -bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L' -bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D' -bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U' -bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R' - -bind-key -n 'M-Left' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L' -bind-key -n 'M-Down' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D' -bind-key -n 'M-Up' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U' -bind-key -n 'M-Right' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R' - -bind-key -T copy-mode-vi 'M-h' select-pane -L -bind-key -T copy-mode-vi 'M-j' select-pane -D -bind-key -T copy-mode-vi 'M-k' select-pane -U -bind-key -T copy-mode-vi 'M-l' select-pane -R -bind-key -T copy-mode-vi 'C-\' select-pane -l -bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+ diff --git a/stowers/tmux/dot-tmux/plugin-configs/rose-pine.conf b/stowers/tmux/dot-tmux/plugin-configs/rose-pine.conf deleted file mode 100644 index 9a7f8bb..0000000 --- a/stowers/tmux/dot-tmux/plugin-configs/rose-pine.conf +++ /dev/null @@ -1,14 +0,0 @@ -# Config for rose-pine theme -set -g @rose_pine_variant 'main' -set -g @rose_pine_host 'off' -set -g @rose_pine_date_time '%H:%M' -set -g @rose_pine_user 'on' -set -g @rose_pine_directory 'off' -set -g @rose_pine_bar_bg_disable 'on' -set -g @rose_pine_only_windows 'off' -set -g @rose_pine_disable_active_window_menu 'on' -set -g @rose_pine_show_current_program 'off' -set -g @rose_pine_show_pane_directory 'off' - -set -g @rose_pine_status_left_prepend_section "#(gitmux -cfg ~/.tmux/gitmux.conf '#{pane_current_path}')" - diff --git a/stowers/tmux/dot-tmux/plugins/tpm b/stowers/tmux/dot-tmux/plugins/tpm deleted file mode 160000 index 99469c4..0000000 --- a/stowers/tmux/dot-tmux/plugins/tpm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946 diff --git a/stowers/wezterm/config.sh b/stowers/wezterm/config.sh deleted file mode 100644 index 5ba72b4..0000000 --- a/stowers/wezterm/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("bash") diff --git a/stowers/zsh/config.sh b/stowers/zsh/config.sh deleted file mode 100644 index 2a9e476..0000000 --- a/stowers/zsh/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -COMMAND_DEPS=("zsh" "starship") diff --git a/tools.mk b/tools.mk new file mode 100644 index 0000000..893f676 --- /dev/null +++ b/tools.mk @@ -0,0 +1,12 @@ +include tools/stow.mk +include tools/nvim.mk +include tools/starship.mk + +.PHONY = tools/all tools/download-all tools/clean + +tools/clean: + rm -rf $(LOCAL_TOOLS_BIN)/stow $(LOCAL_TOOLS_BIN)/nvim $(LOCAL_TOOLS_BIN)/starship + +tools/download-all: $(STOW_DOWNLOAD_LOCATION) $(NVIM_DOWNLOAD_LOCATION) $(STARSHIP_DOWNLOAD_LOCATION) + +tools/all: $(LOCAL_TOOLS_BIN)/stow $(LOCAL_TOOLS_BIN)/nvim $(LOCAL_TOOLS_BIN)/starship diff --git a/tools/nvim.mk b/tools/nvim.mk new file mode 100644 index 0000000..c2d255c --- /dev/null +++ b/tools/nvim.mk @@ -0,0 +1,18 @@ +NVIM_DOWNLOAD_LOCATION ?= $(LOCAL_CACHE)/nvim-0.11.2.tar.gz +NVIM_COMPAT ?= 0 +NVIM_DOWNLOAD_URL ?= https://github.com/neovim/neovim/releases/download/v0.11.2/nvim-linux-x86_64.tar.gz + +ifeq ($(NVIM_COMPAT),1) +NVIM_DOWNLOAD_LOCATION := $(LOCAL_CACHE)/nvim-0.11.2-compat.tar.gz +NVIM_DOWNLOAD_URL := https://github.com/neovim/neovim-releases/releases/download/v0.11.2/nvim-linux-x86_64.tar.gz +endif + +$(NVIM_DOWNLOAD_LOCATION): $(LOCAL_CACHE) + @echo Downloading neovim 0.11.2 + curl -L -o $@ $(NVIM_DOWNLOAD_URL) + +$(LOCAL_TOOLS_BIN)/nvim: $(NVIM_DOWNLOAD_LOCATION) $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN) + @echo Installing neovim 0.11.2 + mkdir -p $(LOCAL_TOOLS)/nvim + tar -C $(LOCAL_TOOLS)/nvim --strip-components=1 -xzf $(NVIM_DOWNLOAD_LOCATION) + cp $(LOCAL_TOOLS)/nvim/bin/nvim $@ diff --git a/tools/starship.mk b/tools/starship.mk new file mode 100644 index 0000000..5a5bea8 --- /dev/null +++ b/tools/starship.mk @@ -0,0 +1,12 @@ +STARSHIP_DOWNLOAD_LOCATION ?= $(LOCAL_CACHE)/starship-1.23.0.tar.gz +STARSHIP_DOWNLOAD_URL ?= https://github.com/starship/starship/releases/download/v1.23.0/starship-x86_64-unknown-linux-musl.tar.gz + +$(STARSHIP_DOWNLOAD_LOCATION): $(LOCAL_CACHE) + @echo Downloading starship 1.23.0 + curl -L -o $@ $(STARSHIP_DOWNLOAD_URL) + +$(LOCAL_TOOLS_BIN)/starship: $(STARSHIP_DOWNLOAD_LOCATION) $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN) + @echo Installing starship 1.23.0 + mkdir -p $(LOCAL_TOOLS)/starship + tar -C $(LOCAL_TOOLS)/starship -xzf $(STARSHIP_DOWNLOAD_LOCATION) + cp $(LOCAL_TOOLS)/starship/starship $@ diff --git a/tools/stow.mk b/tools/stow.mk new file mode 100644 index 0000000..e0dc581 --- /dev/null +++ b/tools/stow.mk @@ -0,0 +1,19 @@ +STOW_DOWNLOAD_LOCATION ?= $(LOCAL_CACHE)/stow-2.4.1.tar.gz +STOW_DOWNLOAD_URL ?= http://ftp.gnu.org/gnu/stow/stow-2.4.1.tar.gz +BUILD_STOW ?= 0 + +$(STOW_DOWNLOAD_LOCATION): $(LOCAL_CACHE) + @echo Downloading Stow 2.4.1 + curl -L -o $@ $(STOW_DOWNLOAD_URL) + +$(LOCAL_TOOLS_BIN)/stow: $(STOW_DOWNLOAD_LOCATION) $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN) +ifeq ($(BUILD_STOW),1) + @echo Building Stow 2.4.1 from source + mkdir -p $(LOCAL_TOOLS)/stow + tar -C $(LOCAL_TOOLS)/stow --strip-components=1 -xzf $(STOW_DOWNLOAD_LOCATION) + cd $(LOCAL_TOOLS)/stow && /bin/sh ./configure && make + cp $(LOCAL_TOOLS)/stow/bin/stow $@ +else + @echo Using system-installed Stow + ln -s $(STOW) $(LOCAL_TOOLS_BIN)/stow +endif