nix3-develop: export NIX_LOG_FD
As far as I can tell, there's no harm to let stdenv know that they can write to file descriptor 2 which is stderr inside of a nix3-develop shell. Contributes towards #336. Change-Id: I51dcbcbc19a1698a0d1255f9d943d9ebd15d115d Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
@@ -364,6 +364,9 @@ struct Common : InstallableCommand, MixProfile
|
||||
out << fmt("%s=\"$%s${nix_saved_%s:+:$nix_saved_%s}\"\n", var, var, var, var);
|
||||
|
||||
out << "export NIX_BUILD_TOP=\"$(mktemp -d -t nix-shell.XXXXXX)\"\n";
|
||||
// We re-export similarly to what occurs inside of a derivation goal `NIX_LOG_FD` to stderr.
|
||||
// So that stdenv hooks that logs information can be observed inside this debugging tool.
|
||||
out << "export NIX_LOG_FD=2\n";
|
||||
for (auto & i : {"TMP", "TMPDIR", "TEMP", "TEMPDIR"})
|
||||
out << fmt("export %s=\"$NIX_BUILD_TOP\"\n", i);
|
||||
|
||||
|
||||
@@ -173,6 +173,9 @@ shellDrv=$(nix-instantiate "$shellDotNix" -A shellDrv.out)
|
||||
|
||||
nix develop $shellDrv -c bash -c '[[ -n $stdenv ]]'
|
||||
|
||||
# Test $NIX_LOG_FD
|
||||
expectStderr 0 nix develop $shellDrv -c bash -c 'echo hello > $NIX_LOG_FD' |& grepQuiet 'hello'
|
||||
|
||||
nix print-dev-env $shellDrv > $TEST_ROOT/dev-env2.sh
|
||||
nix print-dev-env $shellDrv --json > $TEST_ROOT/dev-env2.json
|
||||
|
||||
|
||||
Reference in New Issue
Block a user