Skip to content

Straightforward way to determine if inside a nix shell #6677

@olivia-fl

Description

@olivia-fl

When using nix shell, there is no indication available to the shell environment that it is a shell. This results in poor UX, where I have to remember whether or not I've invoked nix shell in a given terminal, and if so, which packages I added.

The should, at the very least, be an environment variable like the old IN_NIX_SHELL for nix-shell. Ideally, I'd like some variant on IN_NIX_SHELL as well as something like NIX_SHELL_PACKAGES. With these, users can configure their shells to display this information as part of the prompt.

The older nix-shell command messed with the shell prompt directly. I'm not really a fan of that approach though, since it gives no flexibility to the user in how they want the context information to be displayed, and destroys any additional prompt configuration that the user has.


It's also totally possible that what I'm looking for already exists, and I just couldn't find documentation of it. If that's the case, sorry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions