[Nix-dev] nix store: hardlink vs symlink

Florian Friesdorf flo at chaoflow.net
Sat Sep 24 16:55:29 CEST 2011


On Sat, 24 Sep 2011 16:41:07 +0200, Peter Simons <simons at cryp.to> wrote:
> Hi Florian,
> 
>  > Why is nix using symlinks to link files in the nix store?
>  > Would switching to hardlinks break something?
> 
> why do you think that hardlinks would be preferable?

Two profiles:
/tmp/cfl/bad: more than one derivation provides ./bin content,
./bin/python is a symlink

/tmp/cfl/good1: only python provides ./bin content, ./bin/python is not
a symlink.

If ./bin/python is a symlink, python will resolve it to find its home
and set sys.prefix accordingly. It ends with the python derivation being
the home (bad):
readlink("/tmp/cfl/bad/bin/python", "/nix/store/vzpvrymynp4n93bznxha6hadj0ww68vx-python-2.7.1/bin/python", 4096) = 67
readlink("/nix/store/vzpvrymynp4n93bznxha6hadj0ww68vx-python-2.7.1/bin/python", 0x7fff5ec0fa60, 4096) = -1 EINVAL (Invalid argument)


If ./bin/python is not a symlink, the profile python is installed to
becomes the home and therefore sys.prefix (good):
readlink("/tmp/cfl/good1/bin/python", 0x7fff013ffc10, 4096) = -1 EINVAL (Invalid argument)


I think the profile should be the home in both cases.

Making ./bin/python (and ./bin/pythonX.Y) a real file would solve the
problem.

> It is easy to determine where a symlink points to, but it's expensive to
> determine that for a hardlink. That information is oftentimes relevant,
> though, i.e. when analyzing run-time dependencies between store paths.

As python links in many more files than only ./bin/python and
./bin/pythonX.Y, would it be ok, to not symlink these two files, but
simply copy them or is there some other nix-conformant way to avoid the
symlinks for these two files?

-- 
Florian Friesdorf <flo at chaoflow.net>
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo at chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20110924/8f973ea8/attachment.bin 


More information about the nix-dev mailing list