Non-interactive bash errors from flake.nix mkShell

I have a flake I use to enter a development shell environment (via direnv) for building a nodejs vscode extension, and I also run code from that dev shell.

I ran into an issue where the terminal being executed by vscode was behaving strange, specifically throwing the error:

bash: shopt: progcomp: invalid shell option name

And the resulting shell was not very usable at all.

After some digging I found a couple of posts:

The discourse post above has the solution I used, but didn’t include a reference to the actual bash error I was seeing at least, so wanted to post something again here to help people running into this.

Adding buildInputs = [ pkgs.bashInteractive ]; into the mkShell part of my flake.nix solved the issue.

I’m curious if there a better way to fix this so it doesn’t have to be added to each flake?

6 Likes

Same problem here, fixed by follow your solution.

2 Likes

Thanks for posting this. I had to do one more small thing in VSCode to make it work (see step 5). This is what I did

  1. Added buildInputs = [ pkgs.bashInteractive ]; into the mkShell in flake.nix
  2. Closed VSCode.
  3. Ran nix develop
  4. Ran code . in the nix develop shell
  5. Kill terminal in VSCode for any open terminals! (trash can button)
  6. Opened a new terminal in VSCode, and the new terminal was interactive and working

I don’t know why I had to click “Kill Terminal” in VS Code even after following steps 1-4, but for whatever reason that was necessary.

Thank you for this solution!

1 Like

solve it by adding

    shellHook = ''
      export SHELL=/run/current-system/sw/bin/bash
    '';

to mkShell

you don’t have to back out twice from a nested shell and you don’t need the extra buildInputs

3 Likes

It worked for me too :smiley:

This solved the same issue for me, but I tried running codium from a devbox container:

devbox add bashInteractive
refresh

Thanks for sharing