Open amiryal opened 1 week ago
Hi @burke. Would you mind sharing, if you managed to find a solution or a nice workaround?
I remember struggling with this and ripping apart a bunch of code to try to make this not redundantly clone the same repo... if I ended up coming to a solution there, it was not clean.
IMO the nix/ruby stuff all pretty much needs a rewrite.
I’ve found a workaround.
Instead of this:
bundlerEnv {
attrs …;
}
Do this:
bundlerEnv {
attrs …;
ignoreCollisions = true;
}
Now I am wondering if the default in nixpkgs should be changed from ignoreCollisions ? false
to ignoreCollisions ? true
, since Bundler itself doesn’t seem to care anyway (e.g., when more than one gem in the bundle provides the same bin/
script, one gem wins and the rest are ignored). If not that, then at least the message from buildEnv
should be changed, to something that alludes to the ignoreCollisions
argument, as a helpful hint.
Although Bundler itself (not when using nixpkgs bundlerEnv
) does issue a warning when running that conflicting script:
$ bundle exec console
The `console` executable in the `taskinator` gem is being loaded, but it's also present in other gems (plagiarism-checker, rocketchat).
If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).
If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names.
[1] pry(main)>
Describe the bug
As was already noted before in #59284, it is not possible currently to build a
bundlerEnv
derivation from aGemfile.lock
that depends on more than one gem from the same Git repository.Steps To Reproduce
Gemfile
:gemset.nix
:This fails with the error message:
I.e. both gems contain the same
/lib/ruby/gems/3.1.0/bundler/gems/rails-f698d735bfd2/.git/
directory, causing a collision.Expected behavior
Most importantly, it should not fail, no matter the implementation detail of the solution.
A secondary goal may be to save some space by deduplication, as suggested by https://github.com/NixOS/nixpkgs/pull/59284#issuecomment-481916902.
Notify maintainers
@manveru @zimbatm
Metadata