Skip to content

bash: Make interactive by default#379368

Merged
K900 merged 2 commits intoNixOS:stagingfrom
tweag:bash-cleanup
Feb 9, 2025
Merged

bash: Make interactive by default#379368
K900 merged 2 commits intoNixOS:stagingfrom
tweag:bash-cleanup

Conversation

@infinisil
Copy link
Member

@infinisil infinisil commented Feb 4, 2025

This is a continuation of @Artturin's #151227, which I only saw after I was done with this one 😅


The status quo of bash not being interactive is frustrating for many users, because trying to use it interactively is just messed up, and bashInteractive is not intuitive and barely discoverable.

This was brought to my (and many others) attention by @stahnma in his talk at CfgMgmtCamp 2025, where he highlighted this as one of the frustrations he ran into when learning Nix.

Why this is fine to change:

  • No reason for not making interactive the default was given in the original commit (6c6ff6f), but probably it was due to the increase in closure size

  • The closure size only increases by 6.9MiB (19.5%) today, with the added dependency on the store paths for readline and ncurses, which are needed on systems in almost all cases anyways. Even systemd-minimal includes them

  • If somebody really needs to get a more minimal system without those paths, they can use the newly-introduced bashNonInteractive instead now

  • Though to apply it consistently, they'll need to do that in an overlay like

    final: prev: {
      bash = self.bashNonInteractive;
    }

    Or alternatively using the system.replaceDependencies.replacements NixOS option approach.

While there's also other such *Interactive packages that could use the same treatment, bash is a great start.

This was already attempted before in #151227, but was not continued for unknown reason.

To avoid stdenv becoming bigger, all uses of bash in the (working) stdenv's are changed to the explicitly non-interactive version here.

This commit will however still cause a mass rebuild for all packages (and reverse deps) making use of the default bash.

In addition to this main change I've also done a minor bash cleanup in the first commit.

Closes #151227

Things done

  • Check that the main stdenv's don't change (linux, darwin, freebsd, cross)

This work is funded by Tweag and Antithesis

Add a 👍 reaction to pull requests you find important.

@infinisil infinisil requested a review from a team February 4, 2025 16:02
@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: stdenv Standard environment labels Feb 4, 2025
@github-actions github-actions bot added 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. labels Feb 4, 2025
Copy link
Member

@RossComputerGuy RossComputerGuy left a comment

Choose a reason for hiding this comment

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

Looks fine to me

Copy link
Member

@Artturin Artturin left a comment

Choose a reason for hiding this comment

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

Switch base to staging

@wegank wegank added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Feb 4, 2025
Bash is distributing the rendered docs with the source,
so no build tools are used or needed anymore.

This was not the case originally, see dd91141
The status quo of `bash` not being interactive is frustrating for many users,
because trying to use it interactively is just messed up, and
`bashInteractive` is not intuitive and barely discoverable.

This was brought to my (and many others) attention by @stahnma in his
[talk at CfgMgmtCamp 2025](https://cfp.cfgmgmtcamp.org/ghent2025/talk/YUVUTN/),
where he highlighted this as one of the frustrations he ran into when
learning Nix.

Why this is fine:
- No reason for not making interactive the default was given in the original commit (6c6ff6f), but probably it was due to the increase in closure size
- The closure size only increases by 6.9MiB (19.5%) today, with the
  added dependency on the store paths for readline and ncurses, which
  are needed on systems in almost all cases anyways
- If somebody really needs to get a more minimal system, they can use
  the newly-introduced `bashNonInteractive` instead now
- Though to apply it consistently, they'll need to do that in an
  overlay like
  ```
  final: prev: {
    bash = self.bashNonInteractive;
  }
  ```

  Or alternatively using the `system.replaceDependencies.replacements`
  NixOS option approach.

While there's also other such `*Interactive` packages that could use the
same treatment, `bash` is a great start.

This was already attempted before in
NixOS#151227, but was not continued for
unknown reason.

To avoid stdenv becoming bigger, all uses of bash in the (working)
stdenv's are changed to the explicitly non-interactive version here.

This commit will however still cause a mass rebuild for all packages (and reverse deps)
making use of the default bash.
@infinisil infinisil changed the base branch from master to staging February 4, 2025 23:33
@wegank wegank removed the 12.approvals: 3+ This PR was reviewed and approved by three or more persons. label Feb 5, 2025
@K900 K900 merged commit f81ec80 into NixOS:staging Feb 9, 2025
8 of 9 checks passed
@infinisil infinisil deleted the bash-cleanup branch February 10, 2025 19:09
@kirillrdy kirillrdy mentioned this pull request Feb 19, 2025
13 tasks
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tmux-bash-prompt-breaks-inside-of-flakes/60925/7

jhol added a commit to jhol/nixpkgs that referenced this pull request Oct 21, 2025
bash has been interactive by default since this PR [1] was merged. This
commit simplifies dockerTools given that there is now no distinction
between bash and bashInteractive.

  * [1] NixOS#379368

Co-authored-by: commiterate <[email protected]>
Signed-off-by: Joel Holdsworth <[email protected]>
vdemeester pushed a commit to vdemeester/nixpkgs that referenced this pull request Jan 8, 2026
bash has been interactive by default since this PR [1] was merged. This
commit simplifies dockerTools given that there is now no distinction
between bash and bashInteractive.

  * [1] NixOS#379368

Co-authored-by: commiterate <[email protected]>
Signed-off-by: Joel Holdsworth <[email protected]>
vdemeester pushed a commit to vdemeester/nixpkgs that referenced this pull request Jan 9, 2026
bash has been interactive by default since this PR [1] was merged. This
commit simplifies dockerTools given that there is now no distinction
between bash and bashInteractive.

  * [1] NixOS#379368

Co-authored-by: commiterate <[email protected]>
Signed-off-by: Joel Holdsworth <[email protected]>
vdemeester pushed a commit to vdemeester/nixpkgs that referenced this pull request Jan 10, 2026
bash has been interactive by default since this PR [1] was merged. This
commit simplifies dockerTools given that there is now no distinction
between bash and bashInteractive.

  * [1] NixOS#379368

Co-authored-by: commiterate <[email protected]>
Signed-off-by: Joel Holdsworth <[email protected]>
vdemeester pushed a commit to vdemeester/nixpkgs that referenced this pull request Jan 11, 2026
bash has been interactive by default since this PR [1] was merged. This
commit simplifies dockerTools given that there is now no distinction
between bash and bashInteractive.

  * [1] NixOS#379368

Co-authored-by: commiterate <[email protected]>
Signed-off-by: Joel Holdsworth <[email protected]>
vdemeester pushed a commit to vdemeester/nixpkgs that referenced this pull request Jan 12, 2026
bash has been interactive by default since this PR [1] was merged. This
commit simplifies dockerTools given that there is now no distinction
between bash and bashInteractive.

  * [1] NixOS#379368

Co-authored-by: commiterate <[email protected]>
Signed-off-by: Joel Holdsworth <[email protected]>
vdemeester pushed a commit to vdemeester/nixpkgs that referenced this pull request Jan 13, 2026
bash has been interactive by default since this PR [1] was merged. This
commit simplifies dockerTools given that there is now no distinction
between bash and bashInteractive.

  * [1] NixOS#379368

Co-authored-by: commiterate <[email protected]>
Signed-off-by: Joel Holdsworth <[email protected]>
vdemeester pushed a commit to vdemeester/nixpkgs that referenced this pull request Jan 14, 2026
bash has been interactive by default since this PR [1] was merged. This
commit simplifies dockerTools given that there is now no distinction
between bash and bashInteractive.

  * [1] NixOS#379368

Co-authored-by: commiterate <[email protected]>
Signed-off-by: Joel Holdsworth <[email protected]>
thunze added a commit to thunze/reproducible-inference that referenced this pull request Feb 16, 2026
bash is interactive by default since
NixOS/nixpkgs#379368.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 6.topic: stdenv Standard environment 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants