Nix-shell does not use my user's shell (zsh)

Why doesn’t nix-shell use my shell, zsh?

EDIT: Using https://github.com/chisui/zsh-nix-shell was easy enough to solve the problem (but it only works with nix-shell and not nix run). Is there an official way to do it?

I’m pretty sure that is related to reproducibility.

If there is a zsh for you and bash for everyone else, then the environments aren’t the same anymore.

I set zsh as the system shell for “everyone”. It’ll be only me using my personal laptop anyways, no one else.

And all the other computers? That you do not own and control?

Bash is the “guaranteed” shell on nix. It has to be the default environment to run things in. If you need something else, you probably need to build your own stdenv which provides another shell.

Not sure what you mean. I’m not asking for zsh to be the default for NixOS, I’m just asking how to make zsh the default just for me.

That is too advanced for me right now (given the time constraints that I have and needing to get to work on some deliverables that I’ve put off while learning the awesome NixOS).

It’d be neat if nixpkgs had an official option. That’s something for later though.

I’ll use chisui/zsh-nix-shell for now. I’ve opened an issue in that repo asking about support for nix run too.

Well, the main issue is that generic builder is written in bash. nix-shell, among other things, is supposed to place you into the development environment where you can call the bash functions manually. For the other use cases it is not necessary and we have several issues open about that:

Personally, I just run nix-shell … --run fish when I do not need to access builder functions.

Yeah, basically I only been using nix-shell so that I can spin up a new shell with certain binaries present, but not needing the nixos-specific build commands. F.e. to make shells with different versions of node or electron.

If you’re using it for that, you may well be better off using lorri.