NixOS/nixpkgs

mailcatcher: Could not find daemons-1.3.1 in any of the sources (Bundler::GemNotFound)

gtgteq opened this issue · 8 comments

Describe the bug
mailcatcher do not run.

To Reproduce

$ nix-shell -p mailcatcher
...
$ mailcatcher
Traceback (most recent call last):
        9: from /nix/store/mqhb1j757yyffaxk6axkfrayck26507b-mailcatcher-0.7.1/bin/mailcatcher:18:in `<main>'
        8: from /nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
        7: from /nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:20:in `setup'
        6: from /nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:101:in `block in definition_method'
        5: from /nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:226:in `requested_specs'
        4: from /nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:237:in `specs_for'
        3: from /nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:170:in `specs'
        2: from /nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `materialize'
        1: from /nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `map!'
/nix/store/hindv16l90d7i4n3hk5l1x73nj068kyp-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:86:in `block in materialize': Could not find daemons-1.3.1 in any of the sources (Bundler::GemNotFound)

Notify maintainers

@zarelit @nicknovitski

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 4.19.116, NixOS, 20.09pre222138.b3c3a0bd183 (Nightingale)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.4`
 - channels(root): `"nixos-20.09pre222138.b3c3a0bd183"`
 - channels(gtgteq): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
- services.mailcatcher

metasploit meets the same error.

Could not find rake-13.0.1 in any of the sources (Bundler::GemNotFound)

I think I might have the same issue with solargraph:

$ nix run -f channel:nixpkgs-20.03-darwin solargraph -c solargraph -h
Traceback (most recent call last):
	9: from /nix/store/r76fa0d6fbl3pfqqgrwv7br5vvk7mmlc-solargraph-0.38.0/bin/solargraph:18:in `<main>'
	8: from /nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
	7: from /nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:20:in `setup'
	6: from /nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:101:in `block in definition_method'
	5: from /nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:226:in `requested_specs'
	4: from /nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:237:in `specs_for'
	3: from /nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:170:in `specs'
	2: from /nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `materialize'
	1: from /nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `map!'
/nix/store/hkrwdzy7k6kasddlh1ylggn40zdmyrk2-bundler-2.1.4/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:86:in `block in materialize': Could not find jaro_winkler-1.5.4 in any of the sources (Bundler::GemNotFound)

The same command from nixpkgs-19.09 seems fine:

$ nix run -f channel:nixpkgs-19.09-darwin solargraph -c solargraph -h
Commands:
  solargraph --version, -v            # Print the version
  solargraph available-cores          # List available documentation versions
  solargraph bundle                   # Generate documentation for bundled gems
  solargraph clear                    # Delete the cached documentation
  solargraph config [DIRECTORY]       # Create or overwrite a default configuration file
  solargraph download-core [VERSION]  # Download core documentation
  solargraph help [COMMAND]           # Describe available commands or one specific command
  solargraph list-cores               # List the local documentation versions
  solargraph rdoc GEM [VERSION]       # Use RDoc to cache documentation
  solargraph reporters                # Get a list of diagnostics reporters
  solargraph scan                     # Test the workspace for problems
  solargraph socket                   # Run a Solargraph socket server
  solargraph stdio                    # Run a Solargraph stdio server
  solargraph typecheck [FILE]         # Run the type checker
  solargraph uncache GEM [...GEM]     # Delete cached gem documentation

Possibly due to the bundler changes in #81442 ?


EDIT: Hm. But in a docker container (lnl7/nix:2020-03-07), nix run -f channel:nixos-20.03 solargraph -c solargraph -h runs fine. Something in my environment? Or darwin weirdness?

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 18.7.0, macOS 10.14.6`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.4`
 - channels(jon): `"nixpkgs-20.09pre221814.10100a97c89"`
 - nixpkgs: `/Users/jon/.nix-defexpr/channels/nixpkgs

I had a similar issue and I found that my global bundler config was the problem.

# ~/.bundle/config

---
BUNDLE_PATH: "vendor/bundle"

#81442 changed the generated binstubs so that the BUNDLE_PATH environment variable is no longer set which I think means that bundler will now use BUNDLE_PATH from the global config if it exists.

diff --git a/pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb b/pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb
index add5db56d1d..1dfeaadf650 100644
--- a/pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb
+++ b/pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb
@@ -32,7 +32,7 @@ paths.each do |path|
 #

 ENV["BUNDLE_GEMFILE"] = #{gemfile.dump}
-ENV["BUNDLE_PATH"] = #{bundle_path.dump}
+ENV.delete 'BUNDLE_PATH'
 ENV['BUNDLE_FROZEN'] = '1'

 $LOAD_PATH.unshift #{bundler_path.dump} + "/lib"

This seems to result in bundler looking for gems in the wrong location.

A possible workaround is to set BUNDLE_PATH using an environment variable instead of using the global config since this value will be unset by the generated binstubs but will still have an effect when bundler is used from somewhere else.

There is also the BUNDLE_IGNORE_CONFIG environment variable which causes bundler to ignore all configuration but that might have other unwanted effects.

stale commented

I marked this as stale due to inactivity. → More info

@gtgteq Do you still experience the issue? nixos tests of the service are passing and I'm unable to replicate on the current nixpkgs or even in commit b3c3a0bd183

@zarelit Yes. mailcatcher and metasploit don't run. I'm in nixos-unstable 21.03pre265130.f217c0ea7c1.

I removed BUNDLE_PATH in ~/.bundle/config then both programs run fine.

Hopefully #110703 or a similar change will get merged and prevent these problems. I've seen a few issues like this get reported.