-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem? Please describe.
From the "nix shell" manpages, we have the capability to alter the env variables of upcoming new shell via various options (--unset, --ignore-environment, --keep). That's fine if we want to narrow the environment variables, but what if we want to set/expand it ?
Describe the solution you'd like
An additional option to set an env variable in the created shell, for example a "--set var=value" option . This would be usefull when nix shell is executed from a script shebang where the workaround described below doesn't work.
Describe alternatives you've considered
If not executed via a script shebang, we can set the env var while running the command:
$ VAR1=value1 VAR2=value2 nix shell nixpkgs#tree
$ which tree; echo $VAR1
/nix/store/y9x314ap02i1s01ggkh4nmm54ks2ly5d-tree-2.1.1/bin/tree
value1
However this doesn't work vai script shebang.
Additional context
If you have other workarounds or if I missed an already existing option, please notify me,
Priorities
Due to the available workaround, it reduces the criticity of this request. However, such capability might be a good thing to improve Nix shebang usage
Add 👍 to issues you find important.