I've been admiring NixOS from afar but given the bending users have to do to use it in this particular use-case wouldn't it seem that NixOS should present in a transparent and seamless way libraries in these shell-environments the author creates for the build to surface the necessary libraries in such a way that "standard" tools like ld/ldd can find them? Shouldn't it be on the shoulders of NixOS to make this such that users of NixOS need not require patching tools or hacks etc?
NixOS changes some standard conventions of Linux filesystem layout and where tools can expect to find things. These are for good reasons and are due to the core of what NixOS is trying to achieve. For building most things those changes are relatively abstracted away (see ld wrapper script for details) and you don't have to know about them. Fiddling around with something low level like a linker is I think a forgivable situation where the abstraction leaks - it is a process that is inextricably linked to where the system puts things.
My issue is the last sentence:
So… .. turns out there’s more than one lld on NixOS. There’s pkgs.lld, the thing I have been using in the post. And then there’s pkgs.llvmPackages.bintools package, which also contains lld. And that version is actually wrapped into an rpath-setting shell script, the same way ld is.
That means that there isn't a problem. NixOS has fixed this, the system works. Except that you have to magically know which package you should be using. This is the sort of problem that I run into with Nix - it's hard to know the correct incantation.
reply