[Nix-dev] questions on nix trickery

Layus layus.on at gmail.com
Mon May 16 17:07:49 CEST 2016


On 12/05/16 21:05, Alan Belew wrote:
> I have a few questions on the trickery nix uses in its package system.
>
> 1. whenever nix builds a package from source, how does it make sure 
> all the outputs end up in a folder in the store?
It does not. When compilation ends with a success code, everything in 
the store path /is/ the output.
>
> 2. how does nix make sure that programs can find the libraries they 
> need? from what i read i got the impression that nix puts symlinks to 
> the store in lib /lib or /usr/lib directories, but i can't find 
> anything like that on my os.
This is explained roughly in https://nixos.org/nix/about.html.
Executables are linked agains library paths like 
/nix/store/<hash>-foo-lib/lib/libfoo.so .
That path is recorded in the generated executable and used at runtime. 
Default paths are not searched at compilation nor at runtime.

The symlinks in /run/current-system/sw/{bin,lib,...} are only provided 
by NixOS, for some use cases where it is easier to have them gathered 
that way.
For example, it is easier to have the executables at the same place to 
point your PATH to.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160516/59ce1a36/attachment.html 


More information about the nix-dev mailing list