Open ryansch opened 1 year ago
I cannot reproduce this error. I did the following:
$ devenv init
$ echo 3 > .ruby-version
$ nano devenv.nix # See gist below
# An error about nixpkgs-ruby not being part of `devenv.yaml`.
$ nano devenv.yaml # See gist below
# devenv loads
$ gem install rails # Installs rails in $DEVENV_STATE/.bundle/
$ command -v rails # Check whether rails is in $DEVENV_STATE/.bundle
.../.devenv/state/.bundle/ruby/3.2.0/bin/rails
$ rails new foo
See the gist: https://gist.github.com/bobvanderlinden/dab0489bf7840ab3478f3e8773750c49
Alternative to using gem install rails
I also tried to add the Nix package of rails:
packages = [
pkgs.rubyPackages.rails
];
That also seems to be working without error.
Do you have the following in devenv.yaml?
nixpkgs-ruby:
url: github:bobvanderlinden/nixpkgs-ruby
inputs:
nixpkgs:
follows: nixpkgs
To be able to reproduce, could you create a gist similar to mine? That would include the ruby-version being used, the devenv version and the devenv configuration.
@bobvanderlinden You've given me a wonderfully detailed response! Thank you!
I'm running into this issue now with bundler directly at times when I use bundle exec
.
With other gems I'm hitting:
It does look like my installation of bundler 2.4.13 from nix has only the bundler gem in it. Do we need to add that to GEM_HOME?
@bobvanderlinden I have a repro for the binstub issue: https://github.com/ryansch/nix-bundler-issue
I'm unable to run solargraph
or rspec
without bundle exec
.
I didn't use pkgs.rubyPackages.rails
but instead did a gem install rails; rails new foo
.
I found a workaround!
Setting languages.ruby.bundler.enable = false;
causes nix to use the version included with whatever ruby we've installed. Bundler is smart enough to read the Gemfile.lock
and automatically install the specified version and reexec.
Describe the bug It seems that both bundler and ruby are both bringing their own system gems to the party. This is bad.
To reproduce
devenv init
rails new foo
Version devenv: 0.6.2