Is there an alternative to nix-shell which just changes environment variables

Hi there,

I know about direnv and familiar systems which change your Environment Variables as soon as you change directories. I am however not yet familiar with this concept and as of now it is still a bit too magical for me.

What I look for is something like nix-shell, just without spawning a new subshell, i.e. a command which can change the currently active environment variables (and adds a special deactivate function to redo it).

Is there something like this?

No.

But the experimental command print-dev-env can at least be used in the activation style if you are on a POSIX compatible shell.

Here something like eval "$(nix print-dev-env $flakeRef)" works usually to activate.

2 Likes