-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#! nix-shell -i bash
use bash from shell.nix
#6472
base: master
Are you sure you want to change the base?
Conversation
#! nix-shell -i bash
use bash from shell.nix#! nix-shell -i bash
use bash from shell.nix
Oh. As I feared there's an error on Mac. Does anyone who uses mac have an insight into what's going on? error is here https://github.com/NixOS/nix/runs/6275913110?check_suite_focus=true#step:6:1635 |
never mind? error seems to have magically disappeared. |
I’ve restarted the CI ;) |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-30/19112/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Looks good, I’d just like to see a little test showing the various combinations of bash-es that can happen if that’s not too tricky to do (maybe creating different symlinks to the bash
available in the test sandbox, and using $BASH
to know which one was used)
Right now It would be nice if we could go further and remove the error message (and the whole code-path that leads up to it) in the non-interactive case:
Since it's not really an error, and we're not using bash from the environment. I am wary though because this code is reused by a bunch of different commands. I will add tests, and then maybe we should merge this PR as is, and change other things, like the error message, separately? |
+1 for removing that error message, I set |
Triaged in the Nix team meeting 2023-03-17: We'll wait for tests to be added. @Radvendii do you still have capacity to pursue this? |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-03-17-nix-team-meeting-minutes-41/26614/1 |
af73eb1
to
144f540
Compare
So I stumbled across this again 2 years later and finally sat down to tackle it. I realised I'd gotten a couple things wrong.
|
when nix-shell is non-interactive, we don't need to make sure we launch an interactive bash, and it's more important to get the pinned bash
144f540
to
3060f7b
Compare
@thufschmitt @domenkozar @edolstra Sorry if you are no longer the people to ping about this, I know it's been a while I'm not sure who the right people are currently. This issue has come up again recently. The error message can be quite confusing to people. In the case of a nix-shell shebang, I've removed the error message entirely. We will immediately execute the interpreter so we don't need it. In non-shebang cases, I've demoted the detailed error text to info level. People will still be notified that we're taking bash from the environment, and they can find the reason why with verbose flags, but in almost all cases this doesn't matter, so by default it will not be as loud. As far as I'm aware the only thing holding this back was tests. I added those back in June 2024. I think I just didn't do a good job bumping it at the time. CI is failing, but I tested |
When nix-shell is non-interactive, we don't need to make sure we launch
an interactive bash, and it's more important to get the pinned bash
I'm a little worried this will break NixOS/nixpkgs#27493
@domenkozar (from that nixpkgs issue)
@edolstra @thufschmitt (discussed the problem & solution earlier)
TODO:
unset NIX_PATH
, they still get a scary error message despite it not really being an issue in shebang mode.