Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion home-manager/packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ with pkgs;
k6
lean4
lefthook
(if stdenv.isLinux && isDesktop then llama-cpp.override { vulkanSupport = true; } else llama-cpp)
llm
lnav
lsof
Expand Down Expand Up @@ -151,6 +150,7 @@ with pkgs;
keychain
libiconv
libsecret
(if isDesktop then llama-cpp.override { vulkanSupport = true; } else llama-cpp)
opencode
openssl
openssl.dev
Expand Down
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
9 changes: 5 additions & 4 deletions home-manager/programs/ssh/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
_: {
{ lib, ... }:
{
home.file.".ssh/rc" = {
source = ./rc;
force = true;
Expand All @@ -10,7 +11,7 @@ _: {
settings = {
"*" = {
ServerAliveInterval = 60;
IdentityFile = "~/.ssh/id_ed25519";
IdentityFile = lib.mkForce [ "~/.ssh/id_ed25519" ];
SetEnv = {
TERM = "xterm-256color";
};
Expand All @@ -28,12 +29,12 @@ _: {
"kyber" = {
HostName = "kyber.tail950b36.ts.net";
User = "ubuntu";
IdentityFile = "~/.ssh/id_rsa";
IdentityFile = [ "~/.ssh/id_rsa" ];
IdentitiesOnly = "yes";
};
"github.com" = {
ServerAliveInterval = 0;
IdentityFile = "~/.ssh/id_ed25519_github";
IdentityFile = [ "~/.ssh/id_ed25519_github" ];
ControlMaster = "auto";
ControlPath = "~/.ssh/github.sock";
ControlPersist = "3m";
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
27 changes: 24 additions & 3 deletions spec/atuin_history_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,20 @@ The output should include "gomi"
End

It 'adds local binaries to zsh envExtra for non-interactive commands'
When run bash -c "grep -F 'export PATH=\"\$HOME/.bun/bin:\$HOME/.cargo/bin:\$HOME/.local/bin:\$PATH\"' '$ZSH_CONFIG'"
When run bash -c "grep -F 'export PATH=\"\$HOME/.bun/install/global/node_modules/.bin:\$HOME/.bun/bin:\$HOME/.cargo/bin:\$HOME/.local/bin:\$PATH\"' '$ZSH_CONFIG'"
The status should be success
The output should include '.local/bin'
The output should include '.bun/bin'
The output should include '.bun/install/global/node_modules/.bin'
The output should include '.cargo/bin'
End

It 'adds local binaries to bash profileExtra before bashrc'
When run bash -c "grep -F 'export PATH=\"\$HOME/.bun/bin:\$HOME/.cargo/bin:\$HOME/.local/bin:\$PATH\"' '$BASH_CONFIG'"
When run bash -c "grep -F 'export PATH=\"\$HOME/.bun/install/global/node_modules/.bin:\$HOME/.bun/bin:\$HOME/.cargo/bin:\$HOME/.local/bin:\$PATH\"' '$BASH_CONFIG'"
The status should be success
The output should include '.local/bin'
The output should include '.bun/bin'
The output should include '.bun/install/global/node_modules/.bin'
The output should include '.cargo/bin'
End

Expand All @@ -142,11 +144,30 @@ The output should include '.local/bin'
End

It 'adds local binaries to fish shellInit before login-only setup'
When run bash -c "grep -F 'set -gx PATH \$HOME/.bun/bin \$HOME/.cargo/bin \$HOME/.local/bin \$PATH' '$FISH_CONFIG'"
When run bash -c "grep -F 'set -gx PATH \$HOME/.bun/install/global/node_modules/.bin \$HOME/.bun/bin \$HOME/.cargo/bin \$HOME/.local/bin \$PATH' '$FISH_CONFIG'"
The status should be success
The output should include '.local/bin'
The output should include '.bun/bin'
The output should include '.bun/install/global/node_modules/.bin'
The output should include '.cargo/bin'
End

It 'prepends bun global node_modules/.bin after homebrew in bash initExtra so it wins on macOS'
When run bash -c "awk '/export PATH=\"\\/opt\\/homebrew\\/bin:/{brew=NR} /export PATH=\"\\\$HOME\\/.bun\\/install\\/global\\/node_modules\\/.bin:/{bun=NR} END{ if (brew && bun && bun > brew) print \"ok\"; else print \"bad brew=\" brew \" bun=\" bun }' '$BASH_CONFIG'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The awk precedence check scans the entire config file, not just the bashrcExtra/initExtra block it claims to validate. A match from profileExtra or another block could satisfy this test even if the target block regresses. Scope the awk pattern to the intended config block (e.g., track entering/leaving the block) to avoid false positives.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At spec/atuin_history_spec.sh, line 156:

<comment>The awk precedence check scans the entire config file, not just the `bashrcExtra`/`initExtra` block it claims to validate. A match from `profileExtra` or another block could satisfy this test even if the target block regresses. Scope the awk pattern to the intended config block (e.g., track entering/leaving the block) to avoid false positives.</comment>

<file context>
@@ -142,11 +144,30 @@ The output should include '.local/bin'
 End
+
+It 'prepends bun global node_modules/.bin after homebrew in bash initExtra so it wins on macOS'
+When run bash -c "awk '/export PATH=\"\\/opt\\/homebrew\\/bin:/{brew=NR} /export PATH=\"\\\$HOME\\/.bun\\/install\\/global\\/node_modules\\/.bin:/{bun=NR} END{ if (brew && bun && bun > brew) print \"ok\"; else print \"bad brew=\" brew \" bun=\" bun }' '$BASH_CONFIG'"
+The status should be success
+The output should eq 'ok'
</file context>

The status should be success
The output should eq 'ok'
End

It 'prepends bun global node_modules/.bin after homebrew in zsh initContent so it wins on macOS'
When run bash -c "awk '/export PATH=\"\\/opt\\/homebrew\\/bin:/{brew=NR} /export PATH=\"\\\$HOME\\/.bun\\/install\\/global\\/node_modules\\/.bin:/{bun=NR} END{ if (brew && bun && bun > brew) print \"ok\"; else print \"bad brew=\" brew \" bun=\" bun }' '$ZSH_CONFIG'"
The status should be success
The output should eq 'ok'
End

It 'prepends bun global node_modules/.bin after homebrew in fish loginShellInit so it wins on macOS'
When run bash -c "awk '/fish_add_path -p -m \\/opt\\/homebrew\\/bin/{brew=NR} /fish_add_path -p -m ~\\/.bun\\/install\\/global\\/node_modules\\/.bin/{bun=NR} END{ if (brew && bun && bun > brew) print \"ok\"; else print \"bad brew=\" brew \" bun=\" bun }' '$FISH_CONFIG'"
The status should be success
The output should eq 'ok'
Comment on lines +155 to +170

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Scope the awk precedence checks to the intended config block to avoid false positives.

Line 156 and Line 168 currently scan the entire file, so matches from profileExtra/interactiveShellInit can satisfy tests that claim to validate bashrcExtra/loginShellInit. That can hide regressions in the target block.

Suggested fix (scope by block before comparing line order)
-It 'prepends bun global node_modules/.bin after homebrew in bash initExtra so it wins on macOS'
-When run bash -c "awk '/export PATH=\"\\/opt\\/homebrew\\/bin:/{brew=NR} /export PATH=\"\\\$HOME\\/.bun\\/install\\/global\\/node_modules\\/.bin:/{bun=NR} END{ if (brew && bun && bun > brew) print \"ok\"; else print \"bad brew=\" brew \" bun=\" bun }' '$BASH_CONFIG'"
+It 'prepends bun global node_modules/.bin after homebrew in bash bashrcExtra so it wins on macOS'
+When run bash -c "awk '
+  /bashrcExtra = '\'''/ {inblk=1; next}
+  inblk && /'\''';/ {inblk=0}
+  inblk && /export PATH=\"\\/opt\\/homebrew\\/bin:/ {brew=NR}
+  inblk && /export PATH=\"\\\$HOME\\/.bun\\/install\\/global\\/node_modules\\/.bin:/ {bun=NR}
+  END { if (brew && bun && bun > brew) print \"ok\"; else print \"bad brew=\" brew \" bun=\" bun }
+' '$BASH_CONFIG'"

-It 'prepends bun global node_modules/.bin after homebrew in fish loginShellInit so it wins on macOS'
-When run bash -c "awk '/fish_add_path -p -m \\/opt\\/homebrew\\/bin/{brew=NR} /fish_add_path -p -m ~\\/.bun\\/install\\/global\\/node_modules\\/.bin/{bun=NR} END{ if (brew && bun && bun > brew) print \"ok\"; else print \"bad brew=\" brew \" bun=\" bun }' '$FISH_CONFIG'"
+It 'prepends bun global node_modules/.bin after homebrew in fish loginShellInit so it wins on macOS'
+When run bash -c "awk '
+  /loginShellInit = '\'''/ {inblk=1; next}
+  inblk && /'\''';/ {inblk=0}
+  inblk && /fish_add_path -p -m \\/opt\\/homebrew\\/bin/ {brew=NR}
+  inblk && /fish_add_path -p -m ~\\/.bun\\/install\\/global\\/node_modules\\/.bin/ {bun=NR}
+  END { if (brew && bun && bun > brew) print \"ok\"; else print \"bad brew=\" brew \" bun=\" bun }
+' '$FISH_CONFIG'"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/atuin_history_spec.sh` around lines 155 - 170, The awk checks in the
three tests use the whole file so matches outside the target block can satisfy
the assertion; update each test that reads BASH_CONFIG, ZSH_CONFIG, and
FISH_CONFIG (the tests named "prepends bun ... in bash initExtra", "in zsh
initContent", and "in fish loginShellInit") to scope the awk search to the
intended config block: have awk first detect the block start (e.g., the
marker/header for bashrcExtra/initExtra, zsh initContent, fish loginShellInit)
by setting a flag when the block header is seen and clearing it when the next
block header appears, and only record NR for brew and bun while that flag is
set, then compare order; this keeps profileExtra/interactiveShellInit matches
from affecting the bashrc/login checks.

End
End
End
2 changes: 1 addition & 1 deletion spec/ssh_config_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ End

It 'pins the Codex-compatible SSH identity'
When run cat "$SSH_CONFIG_NIX"
The output should include 'IdentityFile = "~/.ssh/id_rsa"'
The output should include 'IdentityFile = [ "~/.ssh/id_rsa" ]'
The output should include 'IdentitiesOnly = "yes"'
End
Comment on lines 14 to 18

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add assertions for wildcard and github.com IdentityFile list rendering.

This only guards kyber; the same contract change on "*" and "github.com" can regress undetected.

Suggested spec extension
 It 'pins the Codex-compatible SSH identity'
 When run cat "$SSH_CONFIG_NIX"
 The output should include 'IdentityFile = [ "~/.ssh/id_rsa" ]'
+The output should include 'IdentityFile = [ "~/.ssh/id_ed25519" ]'
+The output should include 'IdentityFile = [ "~/.ssh/id_ed25519_github" ]'
 The output should include 'IdentitiesOnly = "yes"'
 End
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
It 'pins the Codex-compatible SSH identity'
When run cat "$SSH_CONFIG_NIX"
The output should include 'IdentityFile = "~/.ssh/id_rsa"'
The output should include 'IdentityFile = [ "~/.ssh/id_rsa" ]'
The output should include 'IdentitiesOnly = "yes"'
End
It 'pins the Codex-compatible SSH identity'
When run cat "$SSH_CONFIG_NIX"
The output should include 'IdentityFile = [ "~/.ssh/id_rsa" ]'
The output should include 'IdentityFile = [ "~/.ssh/id_ed25519" ]'
The output should include 'IdentityFile = [ "~/.ssh/id_ed25519_github" ]'
The output should include 'IdentitiesOnly = "yes"'
End
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/ssh_config_spec.sh` around lines 14 - 18, Extend the spec "pins the
Codex-compatible SSH identity" in spec/ssh_config_spec.sh to also assert that
the rendered SSH config includes IdentityFile lists for the wildcard host and
github.com host; after reading "$SSH_CONFIG_NIX" add two expectations similar to
the existing checks (which already assert 'IdentityFile = [ "~/.ssh/id_rsa" ]'
and 'IdentitiesOnly = "yes"') but target the Host="*" block and the
Host="github.com" block (e.g. assert the output contains Host = "*" with
IdentityFile = [ "~/.ssh/id_rsa" ] and Host = "github.com" with IdentityFile = [
"~/.ssh/id_rsa" ]) so both kyber and the other host entries are covered.

End
Expand Down
Loading