mlabs-haskell / lambda-buffers

LambdaBuffers toolkit for sharing types and their semantics between different languages
https://mlabs-haskell.github.io/lambda-buffers/
Apache License 2.0
29 stars 0 forks source link

Recursively copy symlinks instead of copying the symlink for lbf haskell #195

Closed jaredponn closed 4 months ago

jaredponn commented 4 months ago

Following some slack discussion, we noticed that on some people's computers we can't build certain derivations from lbf haskell because their computer couldn't follow a symlink.

So, this PR will copy the symlink recursively instead.

jaredponn commented 4 months ago

Can you do a quick scan and see if other nix libs do this? Thanks!!!

Super interesting!

In other parts of lambda-buffers, we do something like

cp -r autogen/* <blah blah>

see

so we really copy the files over instead of symlinking them. So, we should have no problems there.

But I did some more digging in nixpkgs, and I couldn't find an instance where someone copied the symlink and dumped the copy in $out. Indeed, it's more common for people to simply just symlink what they want i.e., something like

# Either of the following should be fine
ln -s $(readlink autogen) $out/src
ln -s ${lbfBuilt} $out/src

It kinda makes me wonder -- was copying the symlink the problem and would "re-creating" the symlink have fixed it as well? I feel like these should be the same though >.<.

If it's of any consolation, the solution in this PR which "deep copies symlinks in $out" does happen in nixpkgs so maybe there is a reason that I'm not seeing for why people don't copy symlinks to $out e.g. https://github.com/NixOS/nixpkgs/blob/641d3aeeab9bff18b3cb6afe0e721949d1194468/pkgs/stdenv/linux/make-bootstrap-tools.nix#L87