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
14 changes: 14 additions & 0 deletions home-manager/programs/bash/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi

# OpenSSL for cargo builds on Linux (available in login shells)

@cubic-dev-ai cubic-dev-ai Bot Jan 20, 2026

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: OpenSSL export block duplicated in profileExtra and bashrcExtra; login shells source .bashrc and run the block twice, duplicating PKG_CONFIG_PATH entries and bloating env

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/programs/bash/default.nix, line 72:

<comment>OpenSSL export block duplicated in profileExtra and bashrcExtra; login shells source .bashrc and run the block twice, duplicating PKG_CONFIG_PATH entries and bloating env</comment>

<file context>
@@ -68,6 +68,20 @@
         . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
       fi
+
+      # OpenSSL for cargo builds on Linux (available in login shells)
+      if [ "$(uname)" = "Linux" ]; then
+          export XDG_RUNTIME_DIR="/run/user/$(id -u)"
</file context>
Fix with Cubic

if [ "$(uname)" = "Linux" ]; then
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
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
Comment on lines +72 to +79

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

This block defining XDG_RUNTIME_DIR and the OpenSSL environment variables is redundant. The bashrcExtra configuration (lines 36-44) already sets these same variables. Since you are now sourcing .bashrc from .bash_profile (lines 82-84), these variables will be available in login shells, making this block unnecessary. Removing this duplication will make the configuration cleaner and easier to maintain.


Comment on lines +72 to +80

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 OpenSSL and XDG_RUNTIME_DIR environment variables are being set in both bashrcExtra (lines 35-44) and profileExtra (lines 72-79). This creates unnecessary duplication. Since bashrcExtra is sourced by .bashrc and line 82-84 sources .bashrc from .bash_profile, these variables will already be available in login shells through the existing bashrcExtra configuration. The duplication in profileExtra should be removed.

Suggested change
# OpenSSL for cargo builds on Linux (available in login shells)
if [ "$(uname)" = "Linux" ]; then
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
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

Copilot uses AI. Check for mistakes.
# Source .bashrc for login shells to get PATH and other settings
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
'';
};
}
11 changes: 10 additions & 1 deletion home-manager/programs/zsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@
extended = true;
};

initContent = ''
# envExtra goes to .zshenv (always sourced)

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 comment states "always sourced" but should be more specific. The .zshenv file is sourced by all zsh instances including non-interactive shells and scripts, but it's not sourced by other shells like bash. Consider updating the comment to be more precise about the sourcing behavior.

Suggested change
# envExtra goes to .zshenv (always sourced)
# envExtra goes to .zshenv (sourced by all zsh instances, including non-interactive shells)

Copilot uses AI. Check for mistakes.
envExtra = ''
# 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
'';

initContent = ''
# Go configuration
export GOPATH="$HOME/go"

Expand Down
Loading