Compare commits

..

6 Commits

6 changed files with 92 additions and 52 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
# Ignore the actual .bashrc_local with real passwords
# Ignore machine-specific configs with real values
dotfiles/.bashrc_local
dotfiles/.bashrc_paths

View File

@ -52,8 +52,10 @@ All dotfiles are symlinked, not copied. Editing `~/.<file>` directly modifies fi
**Critical Files:**
- `dotfiles/.bashrc` - Main bash configuration with extensive aliases and functions
- `dotfiles/.bashrc_local` - Machine-specific environment variables (PG, MS connection strings)
- `dotfiles/.bashrc_local_example` - Template for setting up machine-specific configs
- `dotfiles/.bashrc_local` - Machine-specific secrets and credentials (PG, MS connection strings)
- `dotfiles/.bashrc_local_example` - Template for `.bashrc_local`
- `dotfiles/.bashrc_paths` - Machine-specific PATH additions and tool inits
- `dotfiles/.bashrc_paths_example` - Template for `.bashrc_paths`
- `dotfiles/.vimrc` - Vim configuration using Vundle plugin manager
- `dotfiles/.tmux.conf` - Tmux configuration with vim-style pane navigation
- `dotfiles/.gitconfig` - Git configuration with custom log format and vimdiff
@ -126,10 +128,20 @@ Base packages installed by `setup_env.sh`:
## Important Conventions
### Environment Variables
Machine-specific environment variables (database connections, tokens, passwords) belong in `dotfiles/.bashrc_local`, not `.bashrc`. This file is sourced by `.bashrc` and should contain sensitive or machine-specific configuration.
### Machine-specific configuration
The `.bashrc_local` file is gitignored for security. Use `dotfiles/.bashrc_local_example` as a template when setting up a new machine. Copy it to `.bashrc_local` and fill in your actual credentials.
There are two gitignored files for machine-specific configuration, both sourced by `.bashrc`:
- **`.bashrc_local`** — secrets and credentials: database connection strings, passwords, tokens. Use `dotfiles/.bashrc_local_example` as a template.
- **`.bashrc_paths`** — PATH additions and tool initializations: neovim, cargo, nvm, java, etc. Use `dotfiles/.bashrc_paths_example` as a template.
On a new machine, copy both examples and fill them in:
```bash
cp dotfiles/.bashrc_local_example dotfiles/.bashrc_local
cp dotfiles/.bashrc_paths_example dotfiles/.bashrc_paths
```
When a tool (cargo, nvm, conda, etc.) auto-appends lines to `.bashrc`, `git status` will show the modification — that's your signal to move those lines to `.bashrc_paths` instead.
### Symlink Pattern
When modifying dotfiles, remember they are symlinked. Changes are automatically tracked by git since the actual files are in the repository's `dotfiles/` directory.

View File

@ -132,7 +132,6 @@ xmspa() {
vd -d "|" - > /dev/null 2>&1
}
alias nv='/opt/nvim-linux64/bin/nvim'
alias gs='git status -s'
alias ga='git status --untracked-files=all -s | fzf -m | awk "{print \$2}" | xargs git add '
alias gx='git status --untracked-files=all -s | fzf -m | awk "{print \$2}" | xargs git checkout '
@ -224,5 +223,5 @@ fi
bind 'set bell-style none'
[ -f ~/.bashrc_local ] && source ~/.bashrc_local
[ -f ~/.bashrc_paths ] && source ~/.bashrc_paths
[[ ":$PATH:" != *":$HOME/.local/bin:"* ]] && export PATH="$HOME/.local/bin:$PATH"
export PATH=$PATH:~/lua-language-server/bin

View File

@ -1,53 +1,24 @@
# .bashrc_local - Machine-specific environment variables
# Copy this file to .bashrc_local and fill in your actual values
# Token for IP services (if needed)
#export IPTOKEN=
# .bashrc_local - Machine-specific secrets and credentials
# Copy this file to .bashrc_local and fill in your actual values.
# All lines are commented out — uncomment and edit what you need.
# PostgreSQL connection string
export PG="psql -U username -d database -p 5432 -h hostname"
# export PG="psql -U username -d database -p 5432 -h hostname"
# SQL Server connection strings
export MS="sqlcmd -U username -C -S servername"
export MSC="sqlcmd -U username -S servername -C -s \| -W"
# export MS="sqlcmd -U username -C -S servername"
# export MSC="sqlcmd -U username -S servername -C -s \| -W"
# export MSW="sqlcmd.exe -S servername -C"
# Java and Gradle paths
export JAVA_HOME=/opt/jdk-20.0.1
export PATH=$PATH:$JAVA_HOME/bin
export PATH=$PATH:/opt/gradle/gradle-8.1/bin
export PATH=$PATH:/opt/mssql-tools18/bin
# Database passwords
# export PGPW=your_postgres_password_here
# export SQLCMDPASSWORD='your_sqlcmd_password_here'
# Runner configuration path
export RUNNER_PATH=/opt/jrunner_conf/
# export RUNNER_PATH=/opt/jrunner_conf/
# Database passwords (fill in your actual passwords)
export DB2PW=your_db2_password_here
export PGPW=your_postgres_password_here
export SQLCMDPASSWORD='your_sqlcmd_password_here'
# Windows SQL Server connection (if needed)
# export MSW="sqlcmd.exe -S servername -C "
# Alternative Java/Gradle versions (commented out)
#export JAVA_HOME=/opt/jdk-19.0.1
#export PATH=$PATH:$JAVA_HOME/bin
#export PATH=$PATH:/opt/gradle/gradle-7.6/bin
#export RUNNER_PATH=/opt/runner/
# Deno installation
export DENO_INSTALL="$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
# NVM (Node Version Manager)
export NVM_DIR="$HOME/.nvm"
[ -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
# Rust / Cargo
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
# opencode
export PATH="$HOME/.opencode/bin:$PATH"
# Token for IP services
# export IPTOKEN=
# SQL Server quick-run alias (customize server/credentials)
# alias mns='fzf | xargs -I {} sqlcmd -U username -S servername -C -i {} | pspg'

View File

@ -0,0 +1,32 @@
# .bashrc_paths - Machine-specific PATH additions and tool initializations
# Copy this file to .bashrc_paths and uncomment what's installed on this machine.
# When a tool (cargo, nvm, conda, etc.) appends lines to .bashrc, move them here instead.
# Neovim (installed by install_neovim.sh)
# [ -d /opt/nvim-linux64/bin ] && export PATH="/opt/nvim-linux64/bin:$PATH"
# Lua language server
# export PATH="$PATH:$HOME/lua-language-server/bin"
# Rust / Cargo
# [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
# opencode
# export PATH="$HOME/.opencode/bin:$PATH"
# NVM (Node Version Manager)
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Deno
# export DENO_INSTALL="$HOME/.deno"
# export PATH="$DENO_INSTALL/bin:$PATH"
# Java / Gradle (installed by install_java_dev.sh)
# export JAVA_HOME=/opt/jdk-20.0.1
# export PATH=$PATH:$JAVA_HOME/bin
# export PATH=$PATH:/opt/gradle/gradle-8.1/bin
# Microsoft SQL Server tools
# export PATH=$PATH:/opt/mssql-tools18/bin

View File

@ -52,15 +52,40 @@ create_symlink() {
ln -s "$target" "$link_name"
}
# Like create_symlink, but if the dotfiles/ target doesn't exist yet and the
# home file is a real file (not a symlink), migrate it into the repo first.
# Used for gitignored files (.bashrc_local, .bashrc_paths) so existing machine
# config is preserved rather than buried in a .backup file.
migrate_and_link() {
local target=$1
local link_name=$2
if [[ ! -e "$target" ]]; then
if [[ -f "$link_name" && ! -L "$link_name" ]]; then
echo "Migrating existing $link_name -> $target"
cp "$link_name" "$target"
elif [[ -f "${target}_example" ]]; then
echo "Bootstrapping $target from example (fill in real values)"
cp "${target}_example" "$target"
fi
fi
create_symlink "$target" "$link_name"
}
# Deploy configuration files as symlinks
deploy_configs() {
echo "Deploying configuration files as symlinks..."
CONFIG_DIR="$(pwd)/dotfiles" # Use the local 'dotfiles' directory in the repo
CONFIG_DIR="$(pwd)/dotfiles"
for config in .bashrc .bashrc_local .vimrc .gitconfig .pspgconf .psqlrc .tmux.conf ; do
for config in .bashrc .vimrc .gitconfig .pspgconf .psqlrc .tmux.conf ; do
create_symlink "$CONFIG_DIR/$config" ~/$config
done
for config in .bashrc_local .bashrc_paths ; do
migrate_and_link "$CONFIG_DIR/$config" ~/$config
done
echo "Sourcing .bashrc..."
source ~/.bashrc
}