Skip to content
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: Don't overwrite PS1. #1408

Closed
wants to merge 1 commit into from
Closed

Conversation

ben0x539
Copy link

Set PS1 only when it's not already set, not when it's set.

Set PS1 only when it's not already set, not when it's set.
@ben0x539
Copy link
Author

[ -n "$PS1" ] && PS1='\n\[\033[1;32m\][nix-shell:\w]\$\[\033[0m\] '; seems pretty backwards to me, we specifically try to source ~/.bashrc earlier, so breaking a prompt set in there seems fairly rude.

@iblech
Copy link

iblech commented Oct 30, 2017

I noticed this behaviour as well. Do we want to merge this pull request, or do we consider the setting of PS1 a feature? In the latter case, we should probably remove the conditional to express our intent more clearly.

@copumpkin
Copy link
Member

I think this boils down to the future Nix UI thing @edolstra's been working on for Nix 1.12: there are two use cases for nix-shell, and they're at odds with one another: in one, you want a build environment pretty close/identical to what an actual builder uses, in order to debug failing derivation builds. That one should always be bash, have all sorts of junk environment variables set, ideally have sandboxing turned on, and always be pure.

In the other case, you want a fancy virtualenv replacement. For that one nobody cares about accuracy and they just want a bunch of packages in scope: there we should allow customizations, different shells, impurity, definitely have no sandboxing, shell hooks, and so on.

The two use cases currently coexist very awkwardly in nix-shell, which started (I believe) as a tool for the former and grew into something folks used for both by generating a fake derivation to "debug". I think if we want to address this, we should probably just take the plunge on the separation in 1.12, and not make major changes to the existing UI.

@iblech
Copy link

iblech commented Oct 31, 2017

Thank you very much for the insightful explanation! Very appreciated. I'm thrilled by the expectation of Nix 1.12, then. :-)

@ben0x539
Copy link
Author

ben0x539 commented Jan 4, 2018

Looking forward to nix 1.12!

@ben0x539 ben0x539 closed this Jan 4, 2018
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.

None yet

3 participants