Conversation
f2926ce to
6a044f9
Compare
6a044f9 to
c6bc675
Compare
|
This would be great for FreeBSD support. |
c6bc675 to
8b81388
Compare
|
👍 I'm a big zsh user and this would be fantastic to have zsh in nix-shell |
|
Is it work now? How can I enable this? |
|
The problem with non-bash shells is that the shell functions defined by stdenv won't be visible. E.g. running |
|
I certainly rather have this with that restriction than nothing at all. Does this have any bearing on #626 and analogous work for other shells? |
|
I, for one, was sorely disappointed to hear that nix was so bash-specific. It's a deal-breaker for me. |
|
@sjfloat I mean nix-shell is not the "core" of nix by any means. |
|
@Ericson2314 No. I maybe should have said, "that nix-shell was so bash-specific". It's just that there are some compelling nix-shell use-cases that grabbed my attention. |
|
Oh, well just running one's own shell within is fine for most practical purposes. I think nix-shell is quite a bit less thought out than most nix tools, but the practical, user-facing ramifications of that are basically just polish, not expressive power. |
|
Oh, I've not given up on nix altogether. I did have a bit of trouble under OS X (which is not my preferred platform, but I am subjected to it at my day-job). I'm going to explore some more under Debian (or maybe NixOS :) |
|
But is it even possible to load ZSH on |
|
Surely, I can use |
|
BTW it's handy to use separate history file for each environment as well. |
|
What's holding this PR up? It was opened a long time ago, doesn't have any conflict with base, is simple, and is often-requested. |
|
Shouldn't nix use shell configured in |
|
If I interpret @edolstra’s comment correctly, I think the way to move this forward would be to make stdenv’s setup script zsh-compatible and set up some automated test to ensure zsh will still work in the future. |
|
I think there are two quite distinct use cases for nix-shell. One is as a development tool when you're writing nix packages; getting you into the shell with all the dependencies required and being able to run the various build phases. There it makes sense to say "the standard build setup is implemented in bash, bash is what you get". But another use case is to drop into ad-hoc views of the software installed on your system, because you want to use that software but don't want it globally installed. Here the availability of I would think that making stdenv's setup simultaneously bash and zsh compatible adds some non-zero ongoing cost (at least having to test all future changes in both), and it only gets you nix-shell compatibility for one additional shell; there are a lot of other reasonable choices for a personal shell. Perhaps a better option would be to a flag or a separate command or something, to inform the system which use case you're intending? I would be perfectly fine with a variant of nix-shell that used my configured shell but didn't give me access to stdenv functions (and I'd use it far more often than one that forced bash but did give me that access; in fact I mildly prefer not having those extra functions in my environment most of the time). But having to switch my SHELL back and forth to get access to both use-cases would be a pain if I need both modes. (Edit: I just saw that #777 is exactly this suggestion) (Personally I currently just have something like |
|
@cumber I use nix-shell mainly to develop things (that aren't necessarily Nix packages). Like a super powered virtualenv. I also make use of the I'm not sure about this, but if nix-shell's functions were made to be restricted to posix sh, then it should work for a lot of different shells right? Does the current system make use of bash specific features? |
|
Would something like |
|
@ktosiek isn't that more or less the same as doing |
|
I marked this as stale due to inactivity. → More info |
|
AFAIK still actual. |
|
Would love to have this. |
|
I marked this as stale due to inactivity. → More info |
|
I would hope stalebot wasn't used. But I guess it's too hard to filter based on days since last change in github issues? |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
When will this be merged if ever? |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
Any issues with this PR, besides conflicts? I would be glad to fix, feel free to |
|
Note to folks searching for a workaround, this can be used instead of export NIX_BUILD_SHELL=<shell> |
|
Also, for what it's worth, inheriting Reasoning: |
|
For me, setting |
|
Discussed in Nix team meeting on 2023-01-09: There are two use cases:
The first should be shell agnostic, the other one must not be. This distinction is made in the new CLI, but not in the old one. The PR does not address the distinction and is therefore not correct, which is why we close it now. We acknowledge that it's a tricky problem to address for |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
* concept: what are flakes
|
Why has this been closed? Isn't this still an issue? |
|
We provided rationale in the closing comment. I find it still holds. In my opinion, the new CLI does not address the issue well. I was recently exploring my hunch that both the package management and the |
|
Here's a little update since this thread seems to have quite some traffic. @roberth is slowly working towards implementing said Nixpkgs facilities in NixOS/nixpkgs#324789, and we're discussing the design on and off. Here's my high-level summary of the next couple of steps: #4702 (comment) |
This adds support for non-bash shells in the interactive mode of nix-shell. I have tested it with zsh and fish. Usage with bash works exactly the same as before.
Since the stdenv/setup script requires bash, the user shell is executed as a command from bash, after PATH, etc. have been configured.
I have also set the correct environment variable for --pure support in zsh.