- Add nixos/ directory with declarative flake.nix and home.nix for NixOS - Make all setup scripts NixOS-aware with proper detection and early exit - Update bashrc, zshrc, and aliases with Go, Ruby on Rails, and Nix profile paths - Replace Rust/Cargo references in shell configs with rbenv/Ruby on Rails - Update README with NixOS quick start and full documentation
72 lines
3.5 KiB
Bash
72 lines
3.5 KiB
Bash
# If not running interactively, don't do anything
|
|
case $- in
|
|
*i*) ;;
|
|
*) return ;;
|
|
esac
|
|
|
|
# ── Identity ───────────────────────────────────────────
|
|
DEFAULT_USER="$USER"
|
|
|
|
# ── Editor ─────────────────────────────────────────────
|
|
export EDITOR='nvim'
|
|
|
|
# ── Nix profile ────────────────────────────────────────
|
|
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
|
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
|
fi
|
|
|
|
# ── PATH additions ─────────────────────────────────────
|
|
export GOPATH="$HOME/go"
|
|
export PATH="$PATH:$GOPATH/bin:/usr/local/go/bin"
|
|
export PATH="$PATH:$HOME/.local/bin"
|
|
export PATH="$PATH:$HOME/.pulumi/bin"
|
|
export CPLUS_INCLUDE_PATH=/usr/local/include
|
|
|
|
# ── Go ──────────────────────────────────────────────────
|
|
# Go is available via Nix profile, home-manager, or /usr/local/go
|
|
|
|
# ── Ruby on Rails (rbenv) ──────────────────────────────
|
|
export PATH="$PATH:$HOME/.rbenv/bin"
|
|
eval "$(rbenv init - bash 2>/dev/null || true)"
|
|
|
|
# ── NVM ────────────────────────────────────────────────
|
|
export NVM_DIR="$HOME/.nvm"
|
|
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
|
|
|
|
# ── SSH agent ──────────────────────────────────────────
|
|
if [ -z "$SSH_AGENT_PID" ] || ! kill -0 "$SSH_AGENT_PID" 2>/dev/null; then
|
|
eval "$(ssh-agent -s)"
|
|
ssh-add 2>/dev/null
|
|
fi
|
|
|
|
# ── Secrets (keep this file chmod 600) ─────────────────
|
|
[ -f "$HOME/.secrets" ] && . "$HOME/.secrets"
|
|
|
|
# ── FZF ────────────────────────────────────────────────
|
|
[ -f ~/.fzf.bash ] && . ~/.fzf.bash
|
|
|
|
# ── Git completion ─────────────────────────────────────
|
|
[ -f /usr/share/bash-completion/completions/git ] \
|
|
&& . /usr/share/bash-completion/completions/git
|
|
|
|
# ── Oh My Posh ─────────────────────────────────────────
|
|
eval "$(oh-my-posh init bash --config ~/.config/oh-my-posh/theme.omp.json)"
|
|
|
|
# ── Aliases ────────────────────────────────────────────
|
|
[ -f "$HOME/dotfiles/aliases.bash" ] && . "$HOME/dotfiles/aliases.bash"
|
|
|
|
# ── work() helper ──────────────────────────────────────
|
|
work() {
|
|
set +e
|
|
local proj="$HOME/Drives/500GB/PycharmProjects/time_logix"
|
|
cd "$proj" || { echo "No such dir: $proj" >&2; return 1; }
|
|
[ -d venv ] || python3 -m venv venv || { echo "venv create failed" >&2; return 1; }
|
|
. venv/bin/activate
|
|
trap 'deactivate 2>/dev/null || true' RETURN
|
|
python main.py
|
|
local code=$?
|
|
cd ~ || true
|
|
[ $code -ne 0 ] && echo "main.py exited with code $code"
|
|
}
|