A sample project using Nix to set up a Ruby environment.
There exists a test_nix.sh file which shows the current issues with this setup. It prints out the LOAD_PATH and GEM_PATH for Ruby and also lists any issues loading gems. This runs on CI so you can verify that things are still working.
Update: It turns out that these particular gems just had a different name that needed to be requireed than their Gem name.
You can see that the ruby_info.sh script prints out where ruby and bundler are coming from to help debug issues. You can see that there are a few gems that are failing to load, although I don't know the root cause:
You can see lower how there is output when trying to load certain gems,
json-2.3.0 in this case. I appears that there is a copy both in gems-bundler-env (which I would expect) and also in ruby2.6.6-json-2.3.0 (which I would not expect).
I have one potential investigation (or red-herring) which is that nix-shell which build derivations for both:
It's not clear why there are multiple copies of these gems, but it's clearly causing issues with constants being initialized twice, etc.

