[Nix-dev] Why is the /nix/store location hardcoded?

David Soergel dev at davidsoergel.com
Thu Apr 22 05:42:15 CEST 2010


> On Apr 21, 2010, at 6:51 PM, David Soergel wrote:
> 
>> Is there some compelling reason why the location of the nix store is fixed at compile time, and why nix-push/nix-pull can only work among machines that agree on the location of the store?


OK, I think I figured it out: the problem is that the Nix dependency resolution stuff occurs at compile time, and absolute paths to dependencies are incorporated into the resulting binaries ("retained dependencies").  This is not the fault of Nix; it's just what the linker does.  So, those binaries will only work on systems where the dependencies are in the same places.

I didn't notice this at first because I'm using Nix expressions to generate things that have no retained dependencies.  Thus, the generated file is invariant with respect to the location of the Nix store.  I had hoped to push and pull these files around to machines where I have the nix store at different paths, but now I see why it's not practical for Nix to support that.

Thanks,

-ds


_______________________________________________________
David Soergel                            (650) 303-5324
dev at davidsoergel.com        http://www.davidsoergel.com
_______________________________________________________




More information about the nix-dev mailing list