Skip to content

"Lighter" and "cleaner" shell for nix develop and nix shell #4609

@garbas

Description

@garbas

Proposal

Final goal is to provide better integration with other shell environments - eg. zsh, fish, ...

Depending how this will be implemented a very nice to have would be to not spawn a new process when entering shell environment. This would mean the current user shell environment would be updated in-place (like direnv does it).

Reasoning

For those who don't use bash using nix-shell, nix develop or nix shell usually means you need to run nix-shell --run $SHELL or creating an alias.

I understand there are good reasons for using bash. Using bash ensures that development environments are very predictably and running commands from nix-shell would act as close as it can within a sandbox.

But on the other side we are forcing developers to use bash or use workarounds. As all debates around editors also debates around shell environments are a hot topic among developers (which is our audience in this case). I wouldn't expect developers switching to bash just so they can use Nix. I would actually expect the opposite, potential users being turned away from Nix due to the lack of good integration with their shell environment.

As with most of the UX decisions also this comes down to compromising one thing over the other.

Bonus

Another bonus to consider is also which environment variables we should expose inside the shell environments.

From the perspective of a developer who just wants to enter a development environments to be able to develop their project, all the extra variables that get created confuse. This "type" of developers are not interested in building a project with Nix, but rather only interested in using Nix to provide needed development environment.

From the perspective of a developer who is working on a tool that will be built later with nix build they want to see - especially when packaging -

We already have options to ignore environment variables (via --ignore-environment flag). We can make this a default and maybe even improve further and provide even "cleaner" development environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXThe way in which users interact with Nix. Higher level than UI.new-cliRelating to the "nix" commandnix-shellnix-shell, nix develop, nix print-dev-env, etcsignificantNovel ideas, large API changes, notable refactorings, issues with RFC potential, etc.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions