This commit is contained in:
MangoPig 2025-12-05 19:01:00 +00:00
parent afd6481ec6
commit cf670488ac
9 changed files with 211 additions and 89 deletions

1
.zshenv Normal file
View File

@ -0,0 +1 @@
# ENV File

58
.zshrc
View File

@ -1,26 +1,26 @@
# .zshrc # .zshrc
# Path to your Oh My Zsh installation. # Zsh Configuration
export ZSH="$HOME/.oh-my-zsh" export ZSH="$HOME/.oh-my-zsh"
PROMPT="%B%~%b :: " PROMPT="%B%~%b :: "
RPROMPT="%n@%m" RPROMPT="%n@%m"
# Plugins # Programming Languages Root
plugins=(git zsh-syntax-highlighting zsh-autosuggestions) export PROG_DIR="$HOME/.programming"
source $ZSH/oh-my-zsh.sh # 1. Go and GVM (Black Box)
export GVM_ROOT="$PROG_DIR/go"
# Only source if the custom GVM exists
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
# Golang and GVM # 2. Node and NVM (Lazy Load)
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm" export NVM_DIR="$PROG_DIR/node"
# Node and NVM (Lazy Load)
export NVM_DIR="$HOME/.nvm"
nvm_load() { nvm_load() {
echo "💤 Waking up NVM..." echo "💤 Waking up NVM..."
unset -f nvm node npm npx unset -f nvm node npm npx
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
"$@" "$@"
} }
@ -29,8 +29,22 @@ node() { nvm_load "node" "$@"; }
npm() { nvm_load "npm" "$@"; } npm() { nvm_load "npm" "$@"; }
npx() { nvm_load "npx" "$@"; } npx() { nvm_load "npx" "$@"; }
# Rust and Cargo # 3. Rust and Cargo
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env" export RUSTUP_HOME="$PROG_DIR/rust/multirust"
export CARGO_HOME="$PROG_DIR/rust/cargo"
# 4. Python (Pyenv + Miniconda)
export PYENV_ROOT="$PROG_DIR/python/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
if command -v conda >/dev/null 2>&1; then
CONDA_BASE=$(conda info --base)
[ -f "$CONDA_BASE/etc/profile.d/conda.sh" ] && source "$CONDA_BASE/etc/profile.d/conda.sh"
fi
# Zoxide # Zoxide
eval "$(zoxide init --cmd cd zsh)" eval "$(zoxide init --cmd cd zsh)"
@ -39,19 +53,11 @@ eval "$(zoxide init --cmd cd zsh)"
[ -f ~/.zsh_aliases ] && source ~/.zsh_aliases [ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
[ -f ~/.zsh_secrets ] && source ~/.zsh_secrets [ -f ~/.zsh_secrets ] && source ~/.zsh_secrets
# Conda (Dynamic Path) # Plugins
# __conda_setup="$('$HOME/Programming/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" plugins=(git zsh-syntax-highlighting zsh-autosuggestions sudo rclone rust nvm golang conda pyenv)
# if [ $? -eq 0 ]; then
# eval "$__conda_setup" source $ZSH/oh-my-zsh.sh
# else
# if [ -f "$HOME/Programming/miniconda3/etc/profile.d/conda.sh" ]; then
# . "$HOME/Programming/miniconda3/etc/profile.d/conda.sh"
# else
# export PATH="$HOME/Programming/miniconda3/bin:$PATH"
# fi
# fi
# unset __conda_setup
# Add to PATH # Add to PATH
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$CARGO_HOME/bin:$PATH"
export PATH="/usr/local/go/bin:$PATH" export PATH="$GOPATH/bin:$PATH"

View File

@ -1,4 +1,4 @@
# Makefile for Dotfiles # Makefile
# Default target # Default target
all: stow all: stow
@ -14,7 +14,7 @@ setup:
# Just stow the dotfiles # Just stow the dotfiles
stow: stow:
stow . --target=$$HOME --ignore=".git" --ignore=".gitignore" --ignore="README.md" --ignore=".zsh_secrets" --ignore=".zsh_secrets.example" --ignore="LICENSE" --ignore="Makefile" stow . --target=$$HOME --ignore=".git" --ignore=".gitignore" --ignore="README.md" --ignore=".zsh_secrets" --ignore=".zsh_secrets.example" --ignore="LICENSE" --ignore="Makefile" --ignore="bin" --ignore="scripts"
@echo "Dotfiles linked." @echo "Dotfiles linked."
# Clean old files and links # Clean old files and links

View File

@ -1,7 +1,9 @@
#!/bin/bash #!/bin/bash
# Path: scripts/base.sh
set -e set -e
# Colors
BLUE='\033[1;34m' BLUE='\033[1;34m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
@ -27,14 +29,12 @@ if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then
fi fi
# 2. Package Installation (OS Dependencies) # 2. Package Installation (OS Dependencies)
# Note: Removed 'go', 'npm', 'cargo' - these are handled by specific scripts
PACKAGES=( PACKAGES=(
curl wget git sudo zsh tmux unzip tar gzip curl wget git sudo zsh tmux unzip tar gzip
build-essential openssl python bison mercurial openssl python bison mercurial
ripgrep fd bat fzf jq btop httpie gnupg zoxide stow ripgrep fd bat fzf jq btop httpie gnupg zoxide stow
bind nmap socat tcpdump net-tools strace gdb hexyl bind nmap socat tcpdump net-tools strace gdb hexyl
rclone rclone
# 'eza' is REMOVED from here for Ubuntu logic below
) )
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
@ -42,10 +42,10 @@ if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
sudo pacman -Sy --noconfirm --needed "${PACKAGES[@]}" base-devel sudo pacman -Sy --noconfirm --needed "${PACKAGES[@]}" base-devel
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "${PACKAGES[@]}" bsdmainutils pkg-config cmake sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "${PACKAGES[@]}" bsdmainutils pkg-config cmake build-essential
fi fi
# Moving Pre-Built bin to /usr/local/bin # Moving Pre-Built bin to .local/bin
mkdir -p "$HOME/.local/bin" mkdir -p "$HOME/.local/bin"
cp -f "$REPO_ROOT/bin/"* "$HOME/.local/bin/" cp -f "$REPO_ROOT/bin/"* "$HOME/.local/bin/"
chmod +x "$HOME/.local/bin/"* chmod +x "$HOME/.local/bin/"*

View File

@ -1,46 +1,78 @@
#!/bin/bash #!/bin/bash
# Path: scripts/go.sh
set -e set -e
BLUE='\033[1;34m' BLUE='\033[1;34m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
RED='\033[1;31m' RED='\033[1;31m'
NC='\033[0m' NC='\033[0m'
echo -e "${BLUE} LOG:${YELLOW} Setting up Go (GVM)...${NC}" # 1. Define Custom GVM Root
export GVM_ROOT="$HOME/.programming/go"
BOOTSTRAP_GO="$GVM_ROOT/bootstrap"
# 1. Install GVM dependencies echo -e "${BLUE} LOG:${YELLOW} Setting up Go and GVM in ${GVM_ROOT}...${NC}"
unalias cd 2>/dev/null || true
# 2. Install GVM if missing # 2. Install GVM (Manual Method)
if [ ! -d "$HOME/.gvm" ]; then # Check for 'scripts' dir instead of '.git', because we are going to delete .git
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) if [ ! -d "$GVM_ROOT/scripts" ]; then
echo -e "${BLUE} LOG:${YELLOW} Cloning GVM...${NC}"
git clone https://github.com/moovweb/gvm.git "$GVM_ROOT"
# CRITICAL FIX: Remove git metadata so GVM treats this as a valid installation
rm -rf "$GVM_ROOT/.git"
# Generate the GVM executable script from default
echo -e "${BLUE} LOG:${YELLOW} Configuring GVM scripts...${NC}"
cp "$GVM_ROOT/scripts/gvm-default" "$GVM_ROOT/scripts/gvm"
sed -i "s|^GVM_ROOT=.*|GVM_ROOT=\"$GVM_ROOT\"|" "$GVM_ROOT/scripts/gvm"
echo -e "${GREEN} SUCCESS:${NC} GVM cloned and configured."
else
echo -e "${GREEN} SKIP:${NC} GVM already installed."
fi fi
# 3. Load GVM # 3. Install Universal Bootstrap Go
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm" if [ ! -d "$BOOTSTRAP_GO" ]; then
echo -e "${BLUE} LOG:${YELLOW} Downloading Bootstrap Go...${NC}"
mkdir -p "$BOOTSTRAP_GO"
# 4. Install Go wget -q https://go.dev/dl/go1.20.5.linux-amd64.tar.gz -O /tmp/go-bootstrap.tar.gz
# Use a known stable version that exists. 1.24.11 is speculative. 1.24.0 is real. tar -C "$BOOTSTRAP_GO" -xzf /tmp/go-bootstrap.tar.gz --strip-components=1
TARGET_GO="go1.24.0" rm /tmp/go-bootstrap.tar.gz
if command -v gvm &> /dev/null; then echo -e "${GREEN} SUCCESS:${NC} Bootstrap Go installed."
if [[ $(gvm list) != *"$TARGET_GO"* ]]; then
echo -e "${BLUE} LOG:${YELLOW} Installing $TARGET_GO...${NC}"
# Try Binary install first (Fastest/Safest)
gvm install "$TARGET_GO" -B || {
echo -e "${RED} LOG: Binary failed. Bootstrapping via go1.22.9...${NC}"
gvm install go1.22.9 -B
gvm use go1.22.9
gvm install "$TARGET_GO"
}
gvm use "$TARGET_GO" --default
echo -e "${GREEN} LOG: Go setup complete.$(go version)${NC}"
else
echo -e "${GREEN} LOG: $TARGET_GO already installed.${NC}"
fi
else else
echo -e "${RED} ERROR: GVM failed to load.${NC}" echo -e "${GREEN} SKIP:${NC} Bootstrap Go already exists."
fi
# 4. Configure Environment for Installation
export PATH="$BOOTSTRAP_GO/bin:$PATH"
export GOROOT_BOOTSTRAP="$BOOTSTRAP_GO"
# Source GVM
set +e
source "$GVM_ROOT/scripts/gvm"
set -e
# Verify GVM loaded correctly
if ! command -v gvm &> /dev/null; then
echo -e "${RED} ERROR:${NC} GVM failed to load."
exit 1 exit 1
fi fi
# 5. Install Target Version
TARGET_VER="go1.24.11"
if ! gvm list | grep -q "$TARGET_VER"; then
echo -e "${BLUE} LOG:${YELLOW} Installing ${TARGET_VER}...${NC}"
gvm install "$TARGET_VER" --prefer-binary
fi
gvm use "$TARGET_VER" --default
echo -e "${GREEN} SUCCESS:${NC} Go setup completed."

View File

@ -1,33 +1,44 @@
#!/bin/bash #!/bin/bash
set -e # Exit on error set -e
# Path: scripts/node.sh
BLUE='\033[1;34m' BLUE='\033[1;34m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
NC='\033[0m' NC='\033[0m'
# 1. Define Custom Path
export NVM_DIR="$HOME/.programming/node"
echo -e "${BLUE} LOG:${YELLOW} Setting up Node.js (NVM)...${NC}" echo -e "${BLUE} LOG:${YELLOW} Setting up Node.js (NVM)...${NC}"
export NVM_DIR="$HOME/.nvm" # 2. Install NVM (if missing)
# 1. Install NVM
if [ ! -d "$NVM_DIR" ]; then if [ ! -d "$NVM_DIR" ]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash mkdir -p "$NVM_DIR"
echo -e "${BLUE} LOG:${YELLOW} Installing NVM to custom path...${NC}"
# PROFILE=/dev/null prevents the installer from editing your .zshrc/.bashrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | PROFILE=/dev/null bash
fi fi
# 2. Load NVM # 3. Source NVM (Load it into current shell)
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# 3. Install Node # 4. Install Node
if command -v nvm &> /dev/null; then if command -v nvm &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Installing LTS...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing LTS...${NC}"
nvm install --lts nvm install --lts
nvm use --lts nvm use --lts
echo -e "${BLUE} LOG:${YELLOW} Installing Global Tools...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing Global Tools...${NC}"
# set +e is safer for npm global installs which can be noisy
# Disable strict error checking for npm global installs (they are noisy)
set +e set +e
npm install -g pnpm yarn npm install -g pnpm yarn || true
set -e set -e
echo -e "${GREEN} LOG: Node setup complete.$(node -v)${NC}" echo -e "${GREEN} LOG: Node setup complete. $(node -v)${NC}"
else
echo -e "${RED} ERROR: NVM failed to load from $NVM_DIR${NC}"
exit 1
fi fi

View File

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
# Path: scripts/provision.sh
set -e set -e
# Colors # Colors
@ -44,7 +47,7 @@ if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
SUDO_GROUP="wheel" SUDO_GROUP="wheel"
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
apt-get update apt-get update
apt-get install -y git make curl sudo apt-get install -y git make curl sudo zsh
SUDO_GROUP="sudo" SUDO_GROUP="sudo"
else else
echo -e "${RED}Unsupported OS: $OS${NC}" echo -e "${RED}Unsupported OS: $OS${NC}"

View File

@ -1,15 +1,69 @@
#!/bin/bash #!/bin/bash
# Path: scripts/python.sh
set -e set -e
# Bold Colors
YELLOW='\033[1;33m'
BLUE='\033[1;34m' BLUE='\033[1;34m'
RED='\033[1;31m' YELLOW='\033[1;33m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
RED='\033[1;31m'
NC='\033[0m' NC='\033[0m'
# Python Setup # OS Detection
echo -e "${BLUE} LOG:${YELLOW} Setting up Python environment...${NC}" if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
fi
# MiniConda Installation # 1. Install Build Dependencies
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
echo -e "${BLUE} LOG:${YELLOW} Installing Arch build dependencies...${NC}"
sudo pacman -S --noconfirm --needed base-devel openssl zlib xz tk libffi bzip2 git
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
echo -e "${BLUE} LOG:${YELLOW} Installing Debian build dependencies...${NC}"
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev git
fi
# 2. Define the Black Box Location
export PYENV_ROOT="$HOME/.programming/python/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
echo -e "${BLUE} LOG:${YELLOW} Setting up Pyenv in ${PYENV_ROOT}...${NC}"
# 3. Install Pyenv
if [ ! -d "$PYENV_ROOT" ]; then
echo -e "${BLUE} LOG:${YELLOW} Cloning Pyenv...${NC}"
git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
echo -e "${BLUE} LOG:${YELLOW} Compiling Pyenv dynamic bash extension...${NC}"
cd "$PYENV_ROOT" && src/configure && make -C src
echo -e "${GREEN} SUCCESS:${NC} Pyenv installed."
else
echo -e "${GREEN} SKIP:${NC} Pyenv already installed."
fi
# Initialize Pyenv for this script session
eval "$(pyenv init -)"
# 4. Install Miniforge (The Community Standard)
TARGET_VER="miniforge3-latest"
if ! pyenv versions | grep -q "$TARGET_VER"; then
echo -e "${BLUE} LOG:${YELLOW} Installing ${TARGET_VER}...${NC}"
echo -e "${YELLOW} NOTE: This avoids Anaconda licensing issues and uses conda-forge default.${NC}"
pyenv install "$TARGET_VER"
echo -e "${GREEN} SUCCESS:${NC} Miniforge installed."
else
echo -e "${GREEN} SKIP:${NC} Miniforge already installed."
fi
# 5. Set Global Default
pyenv global "$TARGET_VER"
echo -e "${GREEN} SUCCESS:${NC} Python setup completed. Default is now Miniforge (Conda)."

View File

@ -1,23 +1,38 @@
#!/bin/bash #!/bin/bash
set -e set -e
# Path: scripts/rust.sh
BLUE='\033[1;34m' BLUE='\033[1;34m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
NC='\033[0m' NC='\033[0m'
# 1. Define Custom Paths
export RUSTUP_HOME="$HOME/.programming/rust/multirust"
export CARGO_HOME="$HOME/.programming/rust/cargo"
echo -e "${BLUE} LOG:${YELLOW} Setting up Rust (Rustup)...${NC}" echo -e "${BLUE} LOG:${YELLOW} Setting up Rust (Rustup)...${NC}"
# 1. Install Rustup # 2. Install Rustup (if missing)
if ! command -v rustup &> /dev/null; then if [ ! -f "$CARGO_HOME/bin/rustup" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y echo -e "${BLUE} LOG:${YELLOW} Installing Rustup to custom path...${NC}"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
else
echo -e "${GREEN} LOG: Rustup already installed in custom path.${NC}"
fi fi
# 2. Source Environment # 3. Source Environment
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env" if [ -f "$CARGO_HOME/env" ]; then
source "$CARGO_HOME/env"
fi
# 3. Update to Stable # 4. Verify and Update
if command -v cargo &> /dev/null; then if command -v cargo &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Updating toolchain...${NC}"
rustup default stable rustup default stable
rustup update rustup update
echo -e "${GREEN} LOG: Rust setup complete.$(cargo --version)${NC}" echo -e "${GREEN} LOG: Rust setup complete.$(cargo --version)${NC}"
else
echo -e "${RED} ERROR: Cargo not found in PATH. Check CARGO_HOME.${NC}"
exit 1
fi fi