Skip to content

fix(shell): add OpenSSL env vars to bash profile and zsh env - #632

Merged
shunkakinoki merged 2 commits into
mainfrom
fix/update-local-binaries-openssl
Jan 20, 2026
Merged

fix(shell): add OpenSSL env vars to bash profile and zsh env#632
shunkakinoki merged 2 commits into
mainfrom
fix/update-local-binaries-openssl

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Jan 20, 2026

Copy link
Copy Markdown
Owner

Changes

  • Add OpenSSL environment variables to bash profileExtra for login shells
  • Move zsh Linux-specific environment variables from initContent to envExtra (.zshenv)
  • Source .bashrc from .bash_profile for consistent PATH setup

Technical Details

  • profileExtra in bash maps to .bash_profile which is sourced by login shells
  • envExtra in zsh maps to .zshenv which is sourced by all zsh instances including non-interactive scripts
  • This ensures cargo/rust builds can find OpenSSL in more shell contexts

Testing

  • Configuration builds successfully with make build
  • OpenSSL env vars available in login shells and zsh scripts on Linux

Generated with Claude Code by claude-opus-4-5-20251101


Summary by cubic

Ensure OpenSSL env vars are loaded in bash login shells and all zsh contexts so cargo builds find OpenSSL reliably. Also source .bashrc from .bash_profile for consistent PATH.

  • Bug Fixes
    • Set OPENSSL_* and PKG_CONFIG_PATH in bash profileExtra on Linux.
    • Move Linux env vars (OpenSSL and XDG_RUNTIME_DIR) to zsh envExtra (.zshenv) so non-interactive zsh scripts inherit them.
    • Source .bashrc from .bash_profile to keep PATH consistent in login shells.

Written for commit 657c316. Summary will update on new commits.

Copilot AI review requested due to automatic review settings January 20, 2026 19:24
@mesa-dot-dev

mesa-dot-dev Bot commented Jan 20, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@shunkakinoki shunkakinoki added the bug Indicates an unexpected problem or unintended behavior. label Jan 20, 2026
@shunkakinoki
shunkakinoki enabled auto-merge (squash) January 20, 2026 19:24
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the shell environment configuration to ensure that OpenSSL is correctly discoverable for Rust/Cargo builds, particularly on Linux systems. It achieves this by strategically placing OpenSSL-related environment variables in appropriate bash and zsh configuration files, specifically targeting login shells for bash and all instances for zsh. Additionally, it standardizes the sourcing of .bashrc in bash login shells to maintain consistent environment settings.

Highlights

  • Bash OpenSSL Environment Variables: OpenSSL environment variables (PKG_CONFIG_PATH, OPENSSL_DIR, OPENSSL_LIB_DIR, OPENSSL_INCLUDE_DIR) are now explicitly set for Linux login shells within the bash profileExtra configuration.
  • Zsh Environment Variable Relocation: Linux-specific environment variables, including XDG_RUNTIME_DIR and the newly added OpenSSL variables, have been moved from zsh's initContent to envExtra. This ensures they are sourced by all zsh instances, including non-interactive scripts, as envExtra maps to .zshenv.
  • Bashrc Sourcing for Login Shells: The .bashrc file is now explicitly sourced from .bash_profile for bash login shells, ensuring consistent PATH and other shell settings are applied across both interactive and login shell contexts.
  • Improved OpenSSL Discoverability: These changes collectively aim to improve the discoverability of OpenSSL for Rust/Cargo builds across various shell contexts on Linux, preventing build failures due to missing library paths.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

- Add OpenSSL environment variables to bash profileExtra for login shells
- Move zsh Linux-specific env vars from initContent to envExtra (.zshenv)
- Ensures cargo builds work in login shells and non-interactive zsh contexts
- Source .bashrc from .bash_profile for consistent PATH setup
@coderabbitai

coderabbitai Bot commented Jan 20, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Enhanced Linux OpenSSL environment configuration for bash and zsh shells.
    • Improved sourcing of user shell configuration files (.bashrc, .zshenv) during login shell initialization.
    • Restructured zsh configuration to better organize environment variable definitions separately from main initialization.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

This PR modifies bash and zsh initialization scripts in home-manager to add Linux-specific OpenSSL environment variables for Rust/Cargo builds and refactors the zsh configuration structure. Bash now sources user's .bashrc and sets OpenSSL-related paths, while zsh introduces a new envExtra attribute to separate environment variables from initialization content.

Changes

Cohort / File(s) Summary
Shell environment configuration (OpenSSL and system paths)
home-manager/programs/bash/default.nix, home-manager/programs/zsh/default.nix
bash: Adds Linux-specific OpenSSL environment variables (PKG_CONFIG_PATH, OPENSSL_DIR, OPENSSL_LIB_DIR, OPENSSL_INCLUDE_DIR) alongside XDG_RUNTIME_DIR in profileExtra and bashrcExtra blocks; sources ~/.bashrc from login shells. zsh: Introduces new public attribute envExtra (string) to hold environment variables sourced from .zshenv; relocates OpenSSL and XDG_RUNTIME_DIR configuration from initContent to envExtra for cleaner separation of concerns.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • Copilot

Poem

🐰 In shells where OpenSSL dwells,
Environment variables cast their spells,
With bashrc sourced and paths set true,
Cargo builds now have their due!
Zsh's envExtra keeps order pristine,

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/update-local-binaries-openssl

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shunkakinoki
shunkakinoki disabled auto-merge January 20, 2026 19:25
@shunkakinoki
shunkakinoki merged commit c621995 into main Jan 20, 2026
2 checks passed
@shunkakinoki
shunkakinoki deleted the fix/update-local-binaries-openssl branch January 20, 2026 19:25

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request correctly sets up OpenSSL environment variables for bash and zsh, which is great for ensuring tools like Cargo can find necessary libraries. The logic for zsh is sound, moving environment settings to .zshenv for broader availability. However, I've found some code duplication in the bash configuration that should be addressed to improve maintainability.

Comment on lines +72 to +79
# 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

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.

@mesa-dot-dev

mesa-dot-dev Bot commented Jan 20, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Added OpenSSL environment variables to bash profile and zsh environment.

What changed?

  • Added OpenSSL environment variables to bash profileExtra for login shells
  • Moved zsh Linux-specific environment variables from initContent to envExtra (.zshenv)
  • Sourced .bashrc from .bash_profile for consistent PATH setup

Description generated by Mesa. Update settings

@mesa-dot-dev

mesa-dot-dev Bot commented Jan 20, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Ensure OpenSSL environment variables are correctly loaded in bash login shells and all zsh contexts to facilitate Cargo builds, and standardize PATH setup in bash login shells by sourcing .bashrc from .bash_profile.

What changed?

  • home-manager/programs/bash/default.nix: Added conditional OpenSSL development environment variables (OPENSSL_* and PKG_CONFIG_PATH) for Linux in profileExtra and sources ~/.bashrc from ~/.bash_profile for consistent PATH and other settings in login shells.
  • home-manager/programs/zsh/default.nix: Refactored zsh configuration to move Linux-specific environment variables, including XDG_RUNTIME_DIR and new OpenSSL-related paths for Rust cargo builds, into a new envExtra attribute for .zshenv, ensuring they are sourced by all zsh instances.

Description generated by Mesa. Update settings

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

1 issue found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="home-manager/programs/bash/default.nix">

<violation number="1" location="home-manager/programs/bash/default.nix:72">
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</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

. '/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

Copilot AI left a comment

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.

Pull request overview

This pull request enhances shell configuration to ensure OpenSSL environment variables are available across different shell contexts for cargo/rust builds. The changes also improve bash login shell behavior by ensuring .bashrc is sourced.

Changes:

  • Move zsh Linux-specific environment variables from initContent to envExtra (.zshenv) for broader availability
  • Add OpenSSL environment variables to bash profileExtra for login shell contexts
  • Source .bashrc from .bash_profile to ensure PATH and other settings are available in login shells

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
home-manager/programs/zsh/default.nix Moves XDG_RUNTIME_DIR and OpenSSL environment variables from initContent to envExtra to ensure they are available in all zsh instances including non-interactive scripts
home-manager/programs/bash/default.nix Adds OpenSSL and XDG_RUNTIME_DIR environment variables to profileExtra and sources .bashrc from .bash_profile for login shells

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +72 to +80
# 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 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.
};

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Indicates an unexpected problem or unintended behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants