nix-index
nix-index copied to clipboard
Better error message if nix-env invocation fails
summary
The below issue has been tracked down to a segmentation fault in nix (NixOS/nix#3377). Nix-index should catch critical failures from nix-env and display a helpful error message in that case, not hang indefinitely.
original issue
As a reference I use nixFlakes on a nixpkgs of mine but the same happens with channel:nixos-unstable.
nix-index has been running for 40min without any other output than querying available packages
22244 <... read resumed>0x7ffda6537c97, 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
22252 <... rt_sigtimedwait resumed>{si_signo=SIGWINCH, si_code=SI_KERNEL}, NULL, 8) = 28 (SIGWINCH)
22244 --- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
22244 read(7, <unfinished ...>
22252 ioctl(2, TIOCGWINSZ, 0x7f159600eb70) = -1 ENOTTY (Inappropriate ioctl for device)
22252 rt_sigtimedwait([HUP INT PIPE TERM WINCH], <unfinished ...>
22260 <... poll resumed>) = 0 (Timeout)
22260 poll([{fd=5, events=POLLIN}], 1, 10000) = 0 (Timeout)
22260 poll([{fd=5, events=POLLIN}], 1, 10000) = 0 (Timeout)
22260 poll([{fd=5, events=POLLIN}], 1, 10000) = 0 (Timeout)
22260 poll([{fd=5, events=POLLIN}], 1, 10000
I've straced it a bit and these are the last lines
In that phase, nix-index
calls nix to determine which derivations are available. Can you check if the following terminates for you:
nix-env -qaP --out-path --xml --arg config '{}' --file '<nixpkgs>'
nix-env -qaP --out-path --xml --arg config '{}' --file '<nixpkgs>' -A xlibs
nix-env -qaP --out-path --xml --arg config '{}' --file '<nixpkgs>' -A haskellPackages
nix-env -qaP --out-path --xml --arg config '{}' --file '<nixpkgs>' -A rPackages
nix-env -qaP --out-path --xml --arg config '{}' --file '<nixpkgs>' -A nodePackages
nix-env -qaP --out-path --xml --arg config '{}' --file '<nixpkgs>' -A coqPackages
I've experienced several crashes with nixFlakes https://github.com/NixOS/nix/issues/3377 and it seems this is the root cause since:
`nix-env -qaP --out-path --xml --arg config '{}' --file '
zsh: segmentation fault (core dumped) nix-env -qaP --out-path --xml --arg config '{}' --file '
Ok, so while this is not a bug per-se in nix-index, it should give a better error message
This happens for me when nix-env prints warnings.
warning: unknown setting 'experimental-features'
warning: unknown setting 'extra-trusted-public-keys'
warning: Nix search path entry '/home/user/src/nixpkgs' does not exist, ignoring
I think overriding the nix to nixUnstable should fix this.