`symlinkJoin` and `nodePackages`

symlinkJoin does not work if the binaries to be linked are in a linked directory themselves. This is the case, for example, for nodePackages. See https://www.ertt.ca/blog/2022/01-12-nix-symlinkJoin-nodePackages/ for a more exact description of the problem (the reason is lndir failing on directory links) and for a possible solution:

postBuild = ''
  for f in $out/lib/node_modules/.bin/*; do
     path="$(readlink --canonicalize-missing "$f")"
     ln -s "$path" "$out/bin/$(basename $f)"
  done
'';

This solution works for me, but I wanted to ask if others also encountered this issue? How did you solve this problem?

May be related to `symlinkjoin` doesn't create link to package in `bin/`.

Definitely related to symlinkJoin needs better handling of folder symlinks.