nix-community / bundix

Generates a Nix expression for your Bundler-managed application. [maintainer=@manveru]
160 stars 54 forks source link

Bundix doesn't work with the `ruby` option in the Gemfile if bundix is built with a different ruby version #81

Open edude03 opened 3 years ago

edude03 commented 3 years ago

So I've been having a weird issue were I couldn't use bundix inside of nix shell using a bundlerEnv.

I'd get an error like couldn't find gem ruby 2.7.2 found 2.6.6 (going from memory, sorry).

Anyway, while debugging a different issue with bundix (why I had both ruby 2.6 and 2.7 in my closure) I found out the bundix derivation has a ruby option. Passing ruby = pkgs.ruby_2_7 into bundix makes this issue go away, which makes me assume bundix is using it's own version of ruby when bundling thus why it can't find the version of ruby the app is using.

I'm not sure if there is a better fix other than passing bundix the same version of ruby as your bundlerEnv, but I figured I'd open an issue to hopefully spark discussion or at least help people running into the same issue

vmsp commented 2 years ago

For anyone, like myself, who stumbles on this issue, you can do this:

nix-shell -p "ruby_3_0" -p "bundix" --run "bundle lock && bundix --ruby=ruby_3_0"