Nixpkgs: Bundix does not work: "Could not find 'bundler'"

Created on 4 Sep 2019  路  8Comments  路  Source: NixOS/nixpkgs

Describe the bug
Bundix, and thus the Ruby infrastructure, does not work.

To Reproduce
Steps to reproduce the behavior:

  1. Run the command $(nix-build '<nixpkgs>' -A bundix --no-out-link)/bin/bundix --magic given in the manual

Expected behavior
I'm not sure, I haven't gotten any farther than trying to run the command that the manual says to run.

Screenshots

$ $(nix-build '<nixpkgs>' -A bundix --no-out-link)/bin/bundix --magic
Traceback (most recent call last):
        8: from /nix/store/5ngg2yc4m5q0l98yqx2lwy261fx6rzn7-bundix-2.4.1/bin/.bundix-wrapped:18:in `<main>'
        7: from /nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/2.5.0/rubygems.rb:304:in `activate_bin_path'
        6: from /nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/2.5.0/rubygems.rb:304:in `synchronize'
        5: from /nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/2.5.0/rubygems.rb:305:in `block in activate_bin_path'
        4: from /nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/2.5.0/rubygems/specification.rb:1440:in `activate'
        3: from /nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `activate_dependencies'
        2: from /nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `each'
        1: from /nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/2.5.0/rubygems/specification.rb:1469:in `block in activate_dependencies'
/nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/2.5.0/rubygems/dependency.rb:312:in `to_specs': Could not find 'bundler' (2.0.1) required by your /home/chris/git/lobsters/Gemfile.lock. (Gem::MissingSpecVersionError)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.0.1`
Checked in 'GEM_PATH=/nix/store/4j8nrml4hnz5ic4xy3immgd0r62dqqsp-bundler-1.17.2/lib/ruby/gems/2.5.0:/nix/store/5ngg2yc4m5q0l98yqx2lwy261fx6rzn7-bundix-2.4.1/lib/ruby/gems/2.5.0:/nix/store/abd2zgz6vvmf9gxw5ra49ibqp1gs15c3-ruby-2.5.5/lib/ruby/gems/2.5.0', execute `gem env` for more information

Additional context
I'm on the nixos-19.03 channel, and the project I'm trying to package is lobsters.

Metadata
Please run nix run nixpkgs.nix-info -c nix-info -m and paste the result.

$ nix run nixpkgs.nix-info -c nix-info -m
error: attribute 'nixpkgs' in selection path 'nixpkgs.nix-info' not found

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
bug

All 8 comments

cc @manveru

I think it's because the Gemfile.lock was created with bundler2, which currently is not in nixpkgs.
Can you try the following?

diff --git i/Gemfile.lock w/Gemfile.lock
index 948509e..48c1902 100644
--- i/Gemfile.lock
+++ w/Gemfile.lock
@@ -280,4 +280,4 @@ DEPENDENCIES
   unicorn

 BUNDLED WITH
-   2.0.1
+   1.17.2

Seems to me that bundler2 now comes with ruby.

bash-3.2$ which bundler
/nix/store/axmaq9if5bmffibr0lng7hkhn1hxqvl9-ruby-2.6.5/bin/bundler
bash-3.2$ bundler --version
Bundler version 2.1.4

I still have the same problem even with ruby 2.6.5. Setting BUNDLED WITH to 1.17.2 fixes it.

Just hit this. anyone know a workaround? Not sure how to use github-pages with nix if can't install from gemfile

I thought this was fixed... @manveru do you know anyone else actively maintaining ruby infrastructure in nixpkgs that we should ping?

The "workaround" is to use bundix and bundler from the same nixpkgs version.

When it complains about old version, just re-generate the Gemfile.lock by running bundle lock which will then change the BUNDLED WITH to the matching one. You can also just delete the version, or change it manually to the version you need.

I'm not sure what we can do on our side to make this more clear... This is mostly an annoying habit of bundler and we cannot circumvent that without patching its Gemfile.lock generation directly.

So bundler upgrades in nixpkgs remain annoying, but are neccesary.

I'm on 20.03, and generating a lockfile with nix's bundler:

> nix-shell --pure -p "ruby.withPackages(ps: with ps; [ jekyll bundler ])" -p bundix

$ bundle lock
Ignoring commonmarker-0.17.13 because its extensions are not built. Try: gem pristine commonmarker --version 0.17.13
Ignoring nokogiri-1.10.9 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.9
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Writing lockfile to /home/tyler/code/savebrowntrack.github.io/Gemfile.lock

$ bundix
Traceback (most recent call last):
        8: from /nix/store/pb6z8zf0ghxw2scwyphmx9k5qzj4cgks-bundix-2.5.0/bin/.bundix-wrapped:18:in `<main>'
        7: from /nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/2.6.0/rubygems.rb:304:in `activate_bin_path'
        6: from /nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/2.6.0/rubygems.rb:304:in `synchronize'
        5: from /nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/2.6.0/rubygems.rb:305:in `block in activate_bin_path'
        4: from /nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/2.6.0/rubygems/specification.rb:1417:in `activate'
        3: from /nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/2.6.0/rubygems/specification.rb:1435:in `activate_dependencies'
        2: from /nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/2.6.0/rubygems/specification.rb:1435:in `each'
        1: from /nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/2.6.0/rubygems/specification.rb:1446:in `block in activate_dependencies'
/nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/2.6.0/rubygems/dependency.rb:313:in `to_specs': Could not find 'bundler' (2.1.4) required by your /home/tyler/code/savebrowntrack.github.io/Gemfile.lock. (Gem::MissingSpecVersionError)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
Checked in 'GEM_PATH=/nix/store/80xrd6npj2c8nsq22gr9jkvyppj1f7my-bundler-1.17.3/lib/ruby/gems/2.6.0:/nix/store/pb6z8zf0ghxw2scwyphmx9k5qzj4cgks-bundix-2.5.0/lib/ruby/gems/2.6.0:/nix/store/7pv5x751g4c1p06hn038iggsgmxzac28-ruby-2.6.5/lib/ruby/gems/2.6.0', execute `gem env` for more information
Was this page helpful?
0 / 5 - 0 ratings

Related issues

edolstra picture edolstra  路  3Comments

langston-barrett picture langston-barrett  路  3Comments

ghost picture ghost  路  3Comments

tomberek picture tomberek  路  3Comments

chris-martin picture chris-martin  路  3Comments