Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions home-manager/programs/bash/bash_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ case ":$PATH:" in
*":$HOME/.bun/bin:"*) ;;
*) export PATH="$HOME/.bun/bin:$PATH" ;;
esac

case ":$PATH:" in
*":$HOME/.bun/install/global/node_modules/.bin:"*) ;;
*) export PATH="$HOME/.bun/install/global/node_modules/.bin:$PATH" ;;
esac
Comment on lines +22 to +25
3 changes: 2 additions & 1 deletion home-manager/programs/bash/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
export PATH="$HOME/.bun/bin:$PATH"
export PATH="/opt/homebrew/opt/postgresql@18/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export PATH="$HOME/.bun/install/global/node_modules/.bin:$PATH"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium

The bun global path is added here without idempotent duplicate checking, unlike the robust pattern in bash_env.sh (lines 22-25). In environments where both bashrcExtra and bash_env.sh are sourced, this could lead to duplicate PATH entries. Consider applying the same case-based guard pattern used in bash_env.sh, or ensure these initialization contexts are mutually exclusive.

Agent: 🏛 Architecture • Fix in Cursor • Fix in Claude

Prompt for Agent
Task: Address review feedback left on GitHub.
Repository: shunkakinoki/dotfiles#1887
File: home-manager/programs/bash/default.nix#L87
Action: Open this file location in your editor, inspect the highlighted code, and resolve the issue described below.

Feedback:
The bun global path is added here without idempotent duplicate checking, unlike the robust pattern in `bash_env.sh` (lines 22-25). In environments where both `bashrcExtra` and `bash_env.sh` are sourced, this could lead to duplicate PATH entries. Consider applying the same case-based guard pattern used in `bash_env.sh`, or ensure these initialization contexts are mutually exclusive.


# Worktrunk shell init
if command -v wt >/dev/null 2>&1; then
Expand All @@ -93,7 +94,7 @@

profileExtra = ''
# Local binaries should be present even before login shells source .bashrc.
export PATH="$HOME/.bun/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH"
export PATH="$HOME/.bun/install/global/node_modules/.bin:$HOME/.bun/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH"

# Nix
if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then
Expand Down
4 changes: 3 additions & 1 deletion home-manager/programs/fish/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
enable = true;
shellInit = ''
# Local binaries should be available before login/interactive-only PATH setup.
set -gx PATH $HOME/.bun/bin $HOME/.cargo/bin $HOME/.local/bin $PATH
set -gx PATH $HOME/.bun/install/global/node_modules/.bin $HOME/.bun/bin $HOME/.cargo/bin $HOME/.local/bin $PATH

# Set XDG_RUNTIME_DIR on Linux for consistent socket paths (e.g., zellij)
if test (uname) = "Linux"
Expand Down Expand Up @@ -55,6 +55,7 @@
fish_add_path -p -m ~/.bun/bin
fish_add_path -p -m /opt/homebrew/opt/postgresql@18/bin
fish_add_path -p -m /opt/homebrew/bin
fish_add_path -p -m ~/.bun/install/global/node_modules/.bin
'';
interactiveShellInit = ''
source ${config.home.homeDirectory}/.config/fish/functions/_hm_load_env_file.fish
Expand All @@ -77,6 +78,7 @@
fish_add_path -p -m ~/.bun/bin
fish_add_path -p -m /opt/homebrew/opt/postgresql@18/bin
fish_add_path -p -m /opt/homebrew/bin
fish_add_path -p -m ~/.bun/install/global/node_modules/.bin
# Worktrunk shell init
if type -q wt
wt config shell init fish | source
Expand Down
3 changes: 2 additions & 1 deletion home-manager/programs/zsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
fi

# Local binaries must be available to non-interactive zsh commands too.
export PATH="$HOME/.bun/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH"
export PATH="$HOME/.bun/install/global/node_modules/.bin:$HOME/.bun/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH"

# Set XDG_RUNTIME_DIR on Linux for consistent socket paths (e.g., zellij)
if [ "$(uname)" = "Linux" ]; then
Expand Down Expand Up @@ -74,6 +74,7 @@
export PATH="$HOME/.bun/bin:$PATH"
export PATH="/opt/homebrew/opt/postgresql@18/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export PATH="$HOME/.bun/install/global/node_modules/.bin:$PATH"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium

This PATH prepend in initContent lacks duplicate checking. Similar to line 35 in envExtra, if both initialization paths execute (depending on shell invocation mode), the bun global path could be added multiple times. Consider wrapping with a case statement like case ":$PATH:" in *":$HOME/.bun/install/global/node_modules/.bin:"*) ;; *) export PATH="...:$PATH" ;; esac to ensure idempotent insertion.

Agent: 🏛 Architecture • Fix in Cursor • Fix in Claude

Prompt for Agent
Task: Address review feedback left on GitHub.
Repository: shunkakinoki/dotfiles#1887
File: home-manager/programs/zsh/default.nix#L77
Action: Open this file location in your editor, inspect the highlighted code, and resolve the issue described below.

Feedback:
This PATH prepend in `initContent` lacks duplicate checking. Similar to line 35 in `envExtra`, if both initialization paths execute (depending on shell invocation mode), the bun global path could be added multiple times. Consider wrapping with a case statement like `case ":$PATH:" in *":$HOME/.bun/install/global/node_modules/.bin:"*) ;; *) export PATH="...:$PATH" ;; esac` to ensure idempotent insertion.


# FNM (Fast Node Manager) configuration
${
Expand Down
Loading