"bind: command not found" when running "bash"

I’m in a nix-shell that is running zsh (thanks for zsh-nix-shell). Then I tried running bash, and this happened:

❯ bash
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found

\[\][\[\]trusktr@laptop:~/src/test]$\[\] exit

Any ideas why this may possibly be? The command line also seems to be escaped.

Hmmm, I discovered that it only happens if I’m already in a nix-shell. For example:

❯ nix-shell -p ~/src/trusktr+nixpkgs/result
                                                                                                                                          
❯ nix run ~/src/trusktr+nixpkgs/result
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found
bind: command not found

\[\][\[\]trusktr@starnix:~/src/test]$\[\] 

I also have this issue where bash appears to have no bind builtin. I’m using macOS Monterey and wanted to install the latest bash version. Which appears to be working fine, but keys are not bound to anything.

Installed via:

nix-env -i bash

add bash to /etc/shells (/Users/red/.nix-profile/bin/bash)

and change with chsh

chsh -s /Users/red/.nix-profile/bin/bash

this works… basically… but bind is missing.
Maybe I need to add something?

I reverted back to zsh (chsh -s /bin/zsh) and when I launch bash from there it presents the same problem:

red@Arkani ~ % which bash
/Users/red/.nix-profile/bin/bash
red@Arkani ~ % bash -version
GNU bash, version 5.1.8(1)-release (x86_64-apple-darwin17.7.0)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
red@Arkani ~ % bash
Arkani:~ red$ bind
bash: bind: command not found

Edit: The default bash (v3.2) works:

red@Arkani ~ % /bin/bash

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ type bind
bind is a shell builtin
bash-3.2$ bind -h
bash: bind: -h: invalid option
bind: usage: bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]

I imagine you’re using the bash attr, and want bashInteractive for a user shell

Oh TIL there is bashInteractive. Running nix-env -i bash-interactive seems to instantly solve my problem. Thanks a lot!