ruby: Fix build on systems with store optimisation

Fixes #4266.  Though I haven't tested this beyond verifying that the ruby expressions build now.

This seems like an awful hack to me.  I think a better solution would be to remove the -d option in https://github.com/NixOS/nixpkgs/blob/52d9c93abef582cfa32d94397aa86f0aa169917c/pkgs/stdenv/generic/setup.sh#L464 as suggested by @wmertens.