-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdenv: fix unbound NIX_LOG_FD in nix develop
#330830
Conversation
When running `nix develop` for a package, Nix records the stdenv environment with NIX_LOG_FD set. That is, when the actual development shell runs, it uses the functions that attempt to log to NIX_LOG_FD, but this variable is not actually set. As a workaround, check whether NIX_LOG_FD is set at runtime. Example (before this change): ```console $ nix develop --file . bash $ echo "${NIX_LOG_FD-unset}" unset $ runPhase unpackPhase bash: "$NIX_LOG_FD": Bad file descriptor Running phase: unpackPhase unpacking source archive /nix/store/v28dv6l0qk3j382kp40bksa1v6h7dx9p-bash-5.2.tar.gz bash: "$NIX_LOG_FD": Bad file descriptor source root is bash-5.2 bash: "$NIX_LOG_FD": Bad file descriptor setting SOURCE_DATE_EPOCH to timestamp 1663942708 of file bash-5.2/y.tab.h ``` After this change: ```console $ nix develop --file . bash $ runPhase unpackPhase Running phase: unpackPhase unpacking source archive /nix/store/v28dv6l0qk3j382kp40bksa1v6h7dx9p-bash-5.2.tar.gz source root is bash-5.2 setting SOURCE_DATE_EPOCH to timestamp 1663942708 of file bash-5.2/y.tab.h ```
a08d02f
to
bd872b4
Compare
Same issue here, but the origin seems to be different.
|
@drupol, IIRC nix-direnv (ab)uses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
Is it a side-effect of NixOS/nix#8987 by chance? |
@trofi, yes, these functions were recorded in a separate derivation where |
Description of changes
When running
nix develop
for a package, Nix records the stdenv environment with NIX_LOG_FD set. That is, when the actual development shell runs, it uses the functions that attempt to log to NIX_LOG_FD, but this variable is not actually set.As a workaround, check whether NIX_LOG_FD is set at runtime.
Example (before this change):
After this change:
Notice that
bash: "$NIX_LOG_FD": Bad file descriptor
lines are gone.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.