Skip to content
Closed
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 dotagents
Submodule dotagents updated 121 files
15 changes: 15 additions & 0 deletions home-manager/modules/npm-globals/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
$DRY_RUN_CMD ${pkgs.bash}/bin/bash ${./install-npm-globals.sh}
'';

# Fix bun postinstall failures (e.g., @beads/bd tarball not extracted)
# Runs after npm globals to extract any tarballs that failed during postinstall
home.activation.fixBunPostinstall = config.lib.dag.entryAfter [ "installNpmGlobals" ] ''
BD_BIN_DIR="$HOME/.bun/install/global/node_modules/@beads/bd/bin"
if [ -d "$BD_BIN_DIR" ]; then
# Check if tarball exists but binary doesn't
TARBALL=$(find "$BD_BIN_DIR" -name "beads_*.tar.gz" 2>/dev/null | head -1)

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.

medium

To make the find command more precise and prevent it from searching into subdirectories unexpectedly, it's good practice to add -maxdepth 1. This ensures you're only looking for the tarball directly within $BD_BIN_DIR.

      TARBALL=$(find "$BD_BIN_DIR" -maxdepth 1 -name "beads_*.tar.gz" 2>/dev/null | head -1)

Copilot AI Jan 20, 2026

Copy link

Choose a reason for hiding this comment

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

The wildcard pattern beads_*.tar.gz may match multiple files if old tarballs aren't cleaned up. Consider adding logic to handle this scenario explicitly, or document the assumption that only one tarball should exist.

Suggested change
TARBALL=$(find "$BD_BIN_DIR" -name "beads_*.tar.gz" 2>/dev/null | head -1)
TARBALLS=$(find "$BD_BIN_DIR" -name "beads_*.tar.gz" 2>/dev/null | sed '/^$/d')
TARBALL_COUNT=$(printf '%s\n' "$TARBALLS" | sed '/^$/d' | wc -l | tr -d ' ')
TARBALL=""
if [ "$TARBALL_COUNT" -eq 1 ]; then
TARBALL="$TARBALLS"
elif [ "$TARBALL_COUNT" -gt 1 ]; then
echo "Warning: multiple beads_*.tar.gz tarballs found in $BD_BIN_DIR; skipping automatic extraction."
fi

Copilot uses AI. Check for mistakes.
if [ -n "$TARBALL" ] && [ ! -f "$BD_BIN_DIR/bd" ]; then
echo "Extracting bd binary from tarball..."
${pkgs.gnutar}/bin/tar -xzf "$TARBALL" -C "$BD_BIN_DIR"
chmod +x "$BD_BIN_DIR/bd" 2>/dev/null || true

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.

medium

The redirection to /dev/null (2>/dev/null) is somewhat redundant when you are already using || true to prevent script failure. By removing 2>/dev/null, you allow chmod to print any errors to stderr (e.g., if the 'bd' binary was not found after extraction). This provides useful feedback for debugging while still ensuring the activation script doesn't exit on error.

        chmod +x "$BD_BIN_DIR/bd" || true

Copilot AI Jan 20, 2026

Copy link

Choose a reason for hiding this comment

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

The chmod command assumes the extracted binary is named exactly 'bd'. If the tarball structure changes and the binary is in a subdirectory or has a different name, this will silently fail. Consider verifying the extraction was successful or making the binary name configurable.

Suggested change
chmod +x "$BD_BIN_DIR/bd" 2>/dev/null || true
BD_BIN_PATH=$(find "$BD_BIN_DIR" -type f \( -name "bd" -o -name "bd*" \) 2>/dev/null | head -n1)
if [ -n "$BD_BIN_PATH" ]; then
chmod +x "$BD_BIN_PATH" 2>/dev/null || true
else
echo "Warning: Could not locate bd binary in $BD_BIN_DIR after extraction."
fi

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +20

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

Handle non鈥慹xecutable bd binaries, not just missing ones.

Right now the fix only runs when the file is absent. If bd exists but lacks the execute bit (a plausible postinstall failure), this block won鈥檛 repair it. Consider checking -x and applying chmod even when the file exists.

馃敡 Suggested tweak
-      if [ -n "$TARBALL" ] && [ ! -f "$BD_BIN_DIR/bd" ]; then
-        echo "Extracting bd binary from tarball..."
-        ${pkgs.gnutar}/bin/tar -xzf "$TARBALL" -C "$BD_BIN_DIR"
-        chmod +x "$BD_BIN_DIR/bd" 2>/dev/null || true
-      fi
+      if [ -n "$TARBALL" ] && [ ! -x "$BD_BIN_DIR/bd" ]; then
+        if [ ! -f "$BD_BIN_DIR/bd" ]; then
+          echo "Extracting bd binary from tarball..."
+          ${pkgs.gnutar}/bin/tar -xzf "$TARBALL" -C "$BD_BIN_DIR"
+        fi
+        chmod +x "$BD_BIN_DIR/bd" 2>/dev/null || true
+      fi
馃 Prompt for AI Agents
In `@home-manager/modules/npm-globals/default.nix` around lines 16 - 20, The
current install block only extracts and chmods when "$BD_BIN_DIR/bd" is missing;
change the logic to also handle non鈥慹xecutable files by testing for execute
permission (use [ -x "$BD_BIN_DIR/bd" ] or its negation) and run chmod +x
regardless if the file exists but is not executable; locate the block using the
TARBALL, BD_BIN_DIR and bd symbols (and the tar/chmod calls) and update the
condition so extraction still occurs if missing, and chmod +x is executed when
bd exists but lacks execute bit.

fi
fi
'';

# Add local and bun bins to PATH
home.sessionPath = [
"$HOME/.local/bin"
Expand Down
6 changes: 6 additions & 0 deletions home-manager/programs/bash/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
# Set XDG_RUNTIME_DIR on Linux for consistent socket paths (e.g., zellij)
if [ "$(uname)" = "Linux" ]; then
export XDG_RUNTIME_DIR="/run/user/$(id -u)"

# OpenSSL for cargo builds (rust crates like openssl-sys)
export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig''${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
export OPENSSL_DIR="${pkgs.openssl.dev}"
export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib"
export OPENSSL_INCLUDE_DIR="${pkgs.openssl.dev}/include"
fi

# Go configuration
Expand Down
6 changes: 6 additions & 0 deletions home-manager/programs/fish/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
# Set XDG_RUNTIME_DIR on Linux for consistent socket paths (e.g., zellij)
if test (uname) = "Linux"
set -gx XDG_RUNTIME_DIR /run/user/(id -u)

# OpenSSL for cargo builds (rust crates like openssl-sys)
set -gx PKG_CONFIG_PATH "${pkgs.openssl.dev}/lib/pkgconfig" $PKG_CONFIG_PATH
set -gx OPENSSL_DIR "${pkgs.openssl.dev}"
set -gx OPENSSL_LIB_DIR "${pkgs.openssl.out}/lib"
set -gx OPENSSL_INCLUDE_DIR "${pkgs.openssl.dev}/include"
end

# Go configuration
Expand Down
Loading