chore: dotfiles cleanup and portability fixes#19
Conversation
Bug fixes: - zshrc: remove broken DEFAULT_USER=whoami`` syntax (unused var) - zshrc: fix hardcoded rbenv PATH to use $HOME - gitconfig: fix safe.directory wrong username (sirup -> ~/.goenv) Portability: - zshrc: add existence guards to all external source calls (fzf-tab, .zsh_env_vars, .zsh_vinted_aliases, dev-tools) - zshrc: guard thefuck eval with command -v check - mac-bootstrap.sh: replace hardcoded /Users/simonas.rupsys with $HOME - git-clone-installs.sh: replace hardcoded username with $USER Deprecated/outdated: - brew-install.sh: remove deprecated homebrew/cask-fonts tap - zshrc: remove EOL OpenSSL 1.1 workaround Cleanup: - zshrc: remove dead check_overcommit() function and empty precmd() - zshrc: remove commented-out terragrunt/tfenv lines - config.yaml: remove redundant f_hammerspoon_init.lua entry - hammerspoon: delete orphan windows.lua_ and windows-bindings-defaults.lua_ Co-Authored-By: Claude AI
There was a problem hiding this comment.
Pull request overview
This PR aims to improve dotfiles portability and reduce setup friction by removing hardcoded user paths, adding guards around optional shell integrations, and cleaning up dotdrop configuration entries.
Changes:
- Replace hardcoded usernames/paths in install scripts and shell config with
$HOME/$USER. - Add file-existence checks before sourcing optional zsh plugins/scripts and guard
thefuckinitialization. - Clean up dotdrop
config.yaml(remove redundant Hammerspoon init mapping) and adjust git safe.directory.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| install/mac-bootstrap.sh | Uses $HOME for writing brew shellenv into the user’s zprofile. |
| install/git-clone-installs.sh | Replaces hardcoded username in chown with $USER. |
| install/brew-install.sh | Removes the homebrew/cask-fonts tap and installs Fira Code cask directly. |
| dotfiles/zshrc | Adds guards around optional source calls and thefuck; updates rbenv PATH. |
| dotfiles/gitconfig | Updates safe.directory to use ~/.goenv instead of a hardcoded home path. |
| config.yaml | Removes redundant explicit mapping for ~/.hammerspoon/init.lua and profile reference. |
Comments suppressed due to low confidence (1)
dotfiles/zshrc:147
rbinit/goinitare executed unconditionally, but the install scripts in this repo don't installrbenvorgoenv(andgoenvclone is commented out), so a fresh terminal session can error with "command not found". Consider guarding these initializations withcommand -v rbenv/goenvchecks, similar to thethefuckguard.
# init all envs
alias init='pyinit;rbinit;goinit'
# pyinit
rbinit
goinit
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| insteadOf = git://github.com/ | ||
| [safe] | ||
| directory = /Users/sirup/.goenv | ||
| directory = ~/.goenv |
There was a problem hiding this comment.
safe.directory expects an absolute path in many Git versions; ~ is not consistently expanded for this setting, which can leave the repo still treated as unsafe. To keep this portable, consider setting this value via an install step that writes the absolute $HOME/.goenv path (e.g., git config --global --add safe.directory ...) or use dotdrop templating to render an absolute path per machine.
| echo 'Installing Homebrew' | ||
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
| echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/simonas.rupsys/.zprofile | ||
| echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile" |
There was a problem hiding this comment.
This append is not idempotent: re-running the bootstrap will keep adding another identical brew shellenv line to ~/.zprofile. Consider only adding it if it's not already present (e.g., grep check) or using a managed block.
| echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile" | |
| if ! grep -q 'eval "$(/opt/homebrew/bin/brew shellenv)"' "$HOME/.zprofile" 2>/dev/null; then | |
| echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile" | |
| fi |
| sudo chown -R "$USER" ~/.config/ | ||
| sudo chown -R "$USER" ~/.local/share |
There was a problem hiding this comment.
If this script is ever executed under sudo, $USER will typically be root, so these chown calls would incorrectly change ownership to root. Prefer using ${SUDO_USER:-$USER} (or similar) to ensure ownership is set back to the invoking user.
| sudo chown -R "$USER" ~/.config/ | |
| sudo chown -R "$USER" ~/.local/share | |
| sudo chown -R "${SUDO_USER:-$USER}" ~/.config/ | |
| sudo chown -R "${SUDO_USER:-$USER}" ~/.local/share |
| [ -f ~/.zsh_env_vars ] && source ~/.zsh_env_vars | ||
| source ~/.zsh_git_aliases | ||
| source ~/.zsh_vinted_aliases | ||
| [ -f ~/.zsh_vinted_aliases ] && source ~/.zsh_vinted_aliases |
There was a problem hiding this comment.
This source is still unconditional. In config.yaml, f_zsh_git_aliases is only installed for some profiles (e.g. Simonass-MacBook-Pro.local) and not for others (e.g. Simonass-Air.lan), so zsh can error on startup. Either guard it with -f like the other source calls, or ensure the dotfile is included in every profile that installs f_zshrc.
rbenv requires both shims and bin on PATH to intercept ruby commands. Previously only bin was set, matching pyenv's pattern but missing shims. Co-Authored-By: Claude AI
- brew-install.sh: install hammerspoon as --cask (GUI app, not formula) - zshrc: simplify vi alias to use PATH-resolved nvim instead of hardcoded brew path - zshrc: resolve nomad completion binary via command -v instead of hardcoded path - install scripts: add set -e so failures abort rather than silently continue Co-Authored-By: Claude AI
2a35cee to
91bbd55
Compare
rbenv/goenv/pyenv shims are already on PATH so commands work without full init. Removes ~200-300ms from shell startup. Use initenvs alias when shell integration (rbenv shell, completions) is needed. Co-Authored-By: Claude AI
- zshrc: add goenv shims to PATH (same fix as rbenv) - zshrc: convert sr alias to function (supports $@), drop broken $@ from p2/ll - zshrc: remove stale commented-out rbenv init line - brew-install.sh: rename neovim -> pynvim (package renamed in 2019) Co-Authored-By: Claude AI
- README: document correct install command requiring $PWD/config.yaml (dotdrop.sh changes cwd at runtime so relative paths don't resolve) - README: fix typo in bootstrap command (.h -> .sh) - README: add instructions for adding a new machine profile - config.yaml: add instignore for .DS_Store to keep hammerspoon dir clean Co-Authored-By: Claude AI
- Add TMPDIR fix for macOS (ensures kitty inherits correct temp dir) - Add sj() SSH jump function via janitor1 - Add make=gmake alias - Add ~/.local/bin to PATH - Add opencode binary path Co-Authored-By: Claude AI
gitconfig: - Add GPG signing key and gpgSign = true - Add /terraform-vault as safe directory gitignore: - Add .cursor to global gitignore hammerspoon/init.lua: - Restore VSCode on v, Cursor on r, add kitten quick-access-terminal on l Co-Authored-By: Claude AI
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
sourcecalls,$HOME/$USERinstead of hardcoded paths in install scriptshomebrew/cask-fontstapcheck_overcommit()+precmd()code, commented-out tfenv/terragrunt lines, redundantf_hammerspoon_init.luaconfig.yaml entry, and orphanwindows.lua_/windows-bindings-defaults.lua_filesTest plan
dotdrop install -p <profile>— no conflicts from config.yaml changes~/.gitconfighassafe.directory = ~/.goenvbash -n install/brew-install.shpasses syntax checkCo-Authored-By: Claude AI