NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.11k stars 1.47k forks source link

nix-build: support for non-bash shells with nix-build / nix-shell #498

Open blueyed opened 9 years ago

blueyed commented 9 years ago

https://github.com/NixOS/nix/issues/355#issuecomment-56693101 mentions that you can use $NIX_BUILD_SHELL to specify the shell being used.

This does not work for zsh (and probably any non-bash shell) however:

% NIX_BUILD_SHELL=zsh nix-shell '<nixpkgs>' -A hello
zsh: no such option: rcfile

Source:

    $ENV{BASH_ENV} = $rcfile;
    my @args = ($ENV{NIX_BUILD_SHELL} // "bash");
    push @args, "--rcfile" if $interactive;

In https://github.com/NixOS/nix/issues/113 / https://github.com/NixOS/nix/commit/ed09d0c0a436a412893ffe817c842827abbec6ed, it was changed to use "bash" instead of $SHELL (by default).

Is it possible and worthwhile to add support for non-Bash shells?

This would also include patches to scripts like https://github.com/NixOS/nix/blob/master/dev-shell then probably.

retrry commented 9 years ago

Yes, please.

jyrimatti commented 9 years ago

Meanwhile, I think you can do it like this:

nix-shell '<nixpkgs>' -A hello --command "exec zsh; return"
avnik commented 9 years ago

Would be nice to allow nix-shell inherit user preffered $SHELL when use default.nix and/or shell.nix

gebner commented 9 years ago

I have made a pull request for this: #545

jasom commented 8 years ago

If you just want a zsh inside a nix shell, this should work find: nix-shell -p zsh --run zsh ...

josiah14 commented 8 years ago

@jasom Your suggestion doesn't work for development sandbox types of purposes.

For instance, if I run nix-shell . --run zsh or nix-shell . --command zsh for a Ruby development shell, I can't see the shell sandbox environment's bundle command that is declared in default.nix

jcrben commented 6 years ago

nevermind, posted to the wrong issue - see https://github.com/NixOS/nixpkgs/issues/29960

chisui commented 6 years ago

<plug shameless="true">In the meantime zsh users can use my zsh-nix-shell plugin.</plug>

nixos-discourse commented 4 years ago

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

https://discourse.nixos.org/t/nix-shell-does-not-use-my-users-shell-zsh/5588/6

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

stale[bot] commented 2 years ago

I closed this issue due to inactivity. → More info

WhyNotHugo commented 2 years ago

Can this be re-opened? It's still an issue.