Skip to content
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

nix-index: Wrap with nix-env in PATH #51165

Merged
merged 1 commit into from Dec 4, 2018

Conversation

infinisil
Copy link
Member

This fixes an impurity in nix-index: Previously it would take the nix-env
binary from the users PATH. I discovered this while trying to run nix-index in a
systemd service, which by default doesn't have nix-env in its path. The
errors it threw were not informative at all and it took me hours to
finally figure out the reason.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This fixes an impurity in nix-index: Previously it would take the nix-env
binary from the users PATH. I discovered this while trying to run nix-index in a
systemd service, which by default doesn't have nix-env in its path. The
errors it threw were not informative at all and it took me hours to
finally figure out the reason.
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: nix-index

Partial log (click to expand)

post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/ipj75mk3da0piqs8x9kgxd14bll7nyix-nix-index-0.1.2
shrinking /nix/store/ipj75mk3da0piqs8x9kgxd14bll7nyix-nix-index-0.1.2/bin/nix-locate
shrinking /nix/store/ipj75mk3da0piqs8x9kgxd14bll7nyix-nix-index-0.1.2/bin/.nix-index-wrapped
strip is /nix/store/n4hb93w6j076xcjw5pm09rdmc09s075b-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/ipj75mk3da0piqs8x9kgxd14bll7nyix-nix-index-0.1.2/bin
patching script interpreter paths in /nix/store/ipj75mk3da0piqs8x9kgxd14bll7nyix-nix-index-0.1.2
/nix/store/ipj75mk3da0piqs8x9kgxd14bll7nyix-nix-index-0.1.2/etc/profile.d/command-not-found.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/ipj75mk3da0piqs8x9kgxd14bll7nyix-nix-index-0.1.2...
/nix/store/ipj75mk3da0piqs8x9kgxd14bll7nyix-nix-index-0.1.2

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: nix-index

Partial log (click to expand)

[ 30%] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/BlockFrequencyInfo.cpp.o
[ 30%] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/BlockFrequencyInfoImpl.cpp.o
[ 30%] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/BranchProbabilityInfo.cpp.o
[ 30%] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/CFG.cpp.o
[ 30%] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/CFGPrinter.cpp.o
[ 30%] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/CFLAndersAliasAnalysis.cpp.o
building of '/nix/store/awxnkzy6ls7ki8s7n12bw1qf15hkc9lw-rustc-1.30.0.drv' timed out after 3600 seconds
cannot build derivation '/nix/store/pn1d764lcjqmyy6hjick36yawify5pd3-cargo-1.30.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/r3vyamga2f1jy1npglr1rmb60b0d483p-nix-index-0.1.2.drv': 2 dependencies couldn't be built
error: build of '/nix/store/r3vyamga2f1jy1npglr1rmb60b0d483p-nix-index-0.1.2.drv' failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: nix-index

Partial log (click to expand)

post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/78m40pnrq49jdfwrv4kyay7qq6rl2s0q-nix-index-0.1.2
shrinking /nix/store/78m40pnrq49jdfwrv4kyay7qq6rl2s0q-nix-index-0.1.2/bin/.nix-index-wrapped
shrinking /nix/store/78m40pnrq49jdfwrv4kyay7qq6rl2s0q-nix-index-0.1.2/bin/nix-locate
strip is /nix/store/qjrnv0qw44bw1hc23zhfh26xd1c25dfs-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/78m40pnrq49jdfwrv4kyay7qq6rl2s0q-nix-index-0.1.2/bin
patching script interpreter paths in /nix/store/78m40pnrq49jdfwrv4kyay7qq6rl2s0q-nix-index-0.1.2
/nix/store/78m40pnrq49jdfwrv4kyay7qq6rl2s0q-nix-index-0.1.2/etc/profile.d/command-not-found.sh: interpreter directive changed from "/bin/sh" to "/nix/store/bpspdmsl0yys24gs70flsvcw3wcnl7lx-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/78m40pnrq49jdfwrv4kyay7qq6rl2s0q-nix-index-0.1.2...
/nix/store/78m40pnrq49jdfwrv4kyay7qq6rl2s0q-nix-index-0.1.2

@worldofpeace
Copy link
Contributor

Perhaps feedback from @bennofs (author) would be desirable here.

@bennofs bennofs merged commit e9ecd7f into NixOS:master Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants