Skip to content

Add minimal bash configuration as a portable fallback - #21

Merged
user3301 merged 3 commits into
masterfrom
add-minimal-bash-config
Sep 12, 2026
Merged

user3301 merged 3 commits into
masterfrom
add-minimal-bash-config

Conversation

@user3301

Copy link
Copy Markdown
Owner

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.

Claude-Session: https://claude.ai/code/session_01NyrQoVjNGCECw6fUdYLNDr

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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.

Comment thread bash/.bashrc Outdated
Comment thread bash/.bashrc Outdated
`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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 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.d wrapper 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
@user3301
user3301 merged commit fd0c23e into master Sep 12, 2026
1 check passed
@user3301
user3301 deleted the add-minimal-bash-config branch September 12, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants