mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 22:46:16 +02:00
nix dev-shell: Set IN_NIX_SHELL in the derivation
This ensures that stdenv / setup hooks take $IN_NIX_SHELL into account. For example, stdenv only sets NIX_SSL_CERT_FILE=/no-cert-file.crt if we're not in a shell.
This commit is contained in:
parent
13604318ad
commit
336afe4d5f
1 changed files with 1 additions and 2 deletions
|
@ -72,7 +72,7 @@ Path getDerivationEnvironment(ref<Store> store, Derivation drv)
|
||||||
if (builder != "bash")
|
if (builder != "bash")
|
||||||
throw Error("'nix shell' only works on derivations that use 'bash' as their builder");
|
throw Error("'nix shell' only works on derivations that use 'bash' as their builder");
|
||||||
|
|
||||||
drv.args = {"-c", "set -e; if [[ -n $stdenv ]]; then source $stdenv/setup; fi; set > $out"};
|
drv.args = {"-c", "set -e; export IN_NIX_SHELL=impure; if [[ -n $stdenv ]]; then source $stdenv/setup; fi; set > $out"};
|
||||||
|
|
||||||
/* Remove derivation checks. */
|
/* Remove derivation checks. */
|
||||||
drv.env.erase("allowedReferences");
|
drv.env.erase("allowedReferences");
|
||||||
|
@ -143,7 +143,6 @@ struct Common : InstallableCommand, MixProfile
|
||||||
|
|
||||||
void makeRcScript(const BuildEnvironment & buildEnvironment, std::ostream & out)
|
void makeRcScript(const BuildEnvironment & buildEnvironment, std::ostream & out)
|
||||||
{
|
{
|
||||||
out << "export IN_NIX_SHELL=1\n";
|
|
||||||
out << "nix_saved_PATH=\"$PATH\"\n";
|
out << "nix_saved_PATH=\"$PATH\"\n";
|
||||||
|
|
||||||
for (auto & i : buildEnvironment.env) {
|
for (auto & i : buildEnvironment.env) {
|
||||||
|
|
Loading…
Reference in a new issue