Add minimal bash configuration as a portable fallback - #21
Merged
Merged
Conversation
Bash gets a stow-shaped bash/ package (.bashrc, .bash_profile) symlinked into $HOME with mkOutOfStoreSymlink, matching how zsh/ is wired. This keeps the same files usable with GNU Stow on non-Nix machines (macOS, Archlinux). - programs.bash is dropped: it generates its own ~/.bashrc, which collides with the symlink. bash-completion replaces what enableCompletion provided. - zoxide added; mcfly moved from common.nix to shell.nix so both shell integrations sit beside the configs that initialize them. Every home profile imports both modules, so availability is unchanged. - .bashrc creates ~/.bash_history when missing; mcfly refuses to start without it. - vi-insert gets \C-l, \C-a, \C-e and \C-k, which readline leaves unbound there but zsh's viins keymap provides. - New bash-syntax flake check, wired into CI alongside zsh-syntax. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyrQoVjNGCECw6fUdYLNDr
There was a problem hiding this comment.
🟡 Changes recommended
Bash currently mishandles GPG_TTY in non-interactive shells and allows local overrides to remove McFly’s prompt hook.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a portable, Stow-compatible Bash fallback alongside the primary Zsh configuration.
Changes:
- Adds Bash startup, history, completion, keybinding, zoxide, and McFly configuration.
- Integrates Bash files and dependencies with Home Manager.
- Adds Bash syntax validation to CI and updates documentation.
File summaries
| File | Description |
|---|---|
bash/.bashrc |
Defines the portable Bash environment and interactive behavior. |
bash/.bash_profile |
Loads .bashrc for login shells. |
home/modules/shell.nix |
Installs shell packages and creates Bash symlinks. |
home/modules/common.nix |
Moves McFly ownership to the shell module. |
flake.nix |
Adds the Bash syntax check. |
.github/workflows/ci.yml |
Runs the new syntax check. |
.gitignore |
Excludes local Bash overrides. |
docs/README.nix.md |
Documents Bash and Stow support. |
Review details
- Files reviewed: 7/8 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
`tty` writes "not a tty" to stdout (not stderr) and exits non-zero when stdin is not a terminal, so the previous `GPG_TTY=$(tty 2>/dev/null)` stored that literal string and clobbered any inherited value. Bash sources ~/.bashrc for non-interactive ssh commands and zsh sources .zshenv for every shell, so this broke GPG signing over ssh. Assign only when `tty` succeeds. Also correct the mcfly comment: the local override file is what runs last, not mcfly. Note there that a local PROMPT_COMMAND assignment drops zoxide's hook, since zoxide occupies index 0 of the array. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyrQoVjNGCECw6fUdYLNDr
There was a problem hiding this comment.
🔵 Needs a closer look
The completion loader directly sources a Bash 4.2+ script under stock macOS Bash 3.2.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
bash/.bashrc:75
- These Nix candidates source bash-completion 2's core script directly, which supports Bash 4.2+. On macOS's stock Bash 3.2, the installed file is found first and emits compatibility errors instead of providing the intended portable fallback. Source the package's version-gated
profile.dwrapper instead.
- Files reviewed: 8/9 changed files
- Comments generated: 0 new
- Review effort level: Balanced
macOS ships bash 3.2.57, where PROMPT_COMMAND is a plain string rather than the array bash 5.1+ uses. Sourcing the local override after the integrations meant a bare `PROMPT_COMMAND=` assignment there wiped both hooks on 3.2, and zoxide's hook even on modern bash, since it sits at index 0. Moving it ahead of them makes both tools append to whatever the local file leaves behind, on either PROMPT_COMMAND flavour. The local file still overrides everything above it and gains the ability to set MCFLY_*/_ZO_* before the tools read them; it only loses the ability to clobber the hooks, which is the point. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyrQoVjNGCECw6fUdYLNDr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bash gets a stow-shaped bash/ package (.bashrc, .bash_profile) symlinked into $HOME with mkOutOfStoreSymlink, matching how zsh/ is wired. This keeps the same files usable with GNU Stow on non-Nix machines (macOS, Archlinux).
Claude-Session: https://claude.ai/code/session_01NyrQoVjNGCECw6fUdYLNDr