Open chooh opened 4 years ago
I looked at /nix/store/20nb9mf9cqrgdyi8ljcsrbqll33fnmf2-ruby-dev-2.5.8/bin/bundle
and found that $GEM_PATH
had been altered with extra paths from nix:
Gem.paths = {
'GEM_PATH' => (
ENV['GEM_PATH'].to_s.split(File::PATH_SEPARATOR) +
["/nix/store/0hxycyxcvfd2mls1znx5ws06dlzwyqqa-bundler-2.1.4/lib/ruby/gems/2.5.0", "/nix/store/qfn1xq5ic1cwmd1iqnqxzl6ns3wk962p-ruby-2.5.8/lib/ruby/gems/2.5.0"]
).join(File::PATH_SEPARATOR)
}
If I take my example above and run it:
GEM_PATH=/nix/store/0hxycyxcvfd2mls1znx5ws06dlzwyqqa-bundler-2.1.4/lib/ruby/gems/2.5.0:/nix/store/qfn1xq5ic1cwmd1iqnqxzl6ns3wk962p-ruby-2.5.8/lib/ruby/gems/2.5.0 rake -T
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/Library/Ruby/Gems/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
It works as expected.
Furthermore gem env
shows as follows:
- GEM PATHS:
- /Users/chooh/project/.direnv/ruby
- /Users/chooh/.gem/ruby/2.5.0
- /nix/store/qfn1xq5ic1cwmd1iqnqxzl6ns3wk962p-ruby-2.5.8/lib/ruby/gems/2.5.0
There is no /nix/store/0hxycyxcvfd2mls1znx5ws06dlzwyqqa-bundler-2.1.4/lib/ruby/gems/2.5.0
in the GEM PATHS.
I marked this as stale due to inactivity. → More info
Describe the bug I am using nix and direnv to have a development environment for a rails application. My
shell.nix
looks like this:To Reproduce Steps to reproduce the behavior:
nix-shell -p ruby_2_5.devEnv
Expected behavior I expect that I already have gem
bundler
and I don't have to install it again withgem install bundler
.Notify maintainers @zimbatm
Metadata Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.