ruby: Fix build on systems with store optimisation. Closes #4273. #4266 promises a better fix.

(The build process attempted to copy file a overwriting file b, where a
and b are hard-linked, which results in cp returning a non-zero exit
code.)
https://github.com/NixOS/nixpkgs/issues/4266