Hey folks, I’m having trouble getting a ruby environment working. I think the issue is to do with a gem which is a git dependency, rather than rubygems. Given the following shell.nix
{ pkgs ? import <nixpkgs> {}}:
let
gems = pkgs.bundlerEnv rec {
name = "my-package";
gemdir = ./.;
};
in
pkgs.mkShell {
nativeBuildInputs = [
gems
gems.ruby
];
}
And the following gemset.nix
{
getsource = {
groups = ["default"];
platforms = [];
source = {
url = "https://github.com/alexjg/getsource.git";
rev = "cedfca1dca74d1ef185233634c96620c89167b4e";
sha256 = "1nzxqqv34mf0bn5xgnd8gmzm7yw3cqmzdrypbsvj1c9idiaq72rd";
type = "git";
fetchSubmodules = false;
};
version = "0.2.2";
};
}
I get the following error in an irb
session:
irb(main):001:0> require "bundler"
=> true
irb(main):002:0> Bundler.setup()
/nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated
Traceback (most recent call last):
13: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/bin/irb:23:in `<main>'
12: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/bin/irb:23:in `load'
11: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
10: from (irb):2
9: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler.rb:107:in `setup'
8: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/runtime.rb:20:in `setup'
7: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/runtime.rb:108:in `block in definition_method'
6: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/definition.rb:226:in `requested_specs'
5: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/definition.rb:237:in `specs_for'
4: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/definition.rb:170:in `specs'
3: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/spec_set.rb:85:in `materialize'
2: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/spec_set.rb:85:in `map!'
1: from /nix/store/cyn154y4fjg6psapsi35h3bpjki3c5wa-ruby-2.6.6/lib/ruby/2.6.0/bundler/spec_set.rb:91:in `block in materialize'
Bundler::GemNotFound (Could not find getsource-0.2.2 in any of the sources)
So it looks like the getsource gem has not ended up on the gem path for some reason. Anyone with any experience with the ruby packaging stuff know what’s going on here?
There’s a full example with a Gemfile.lock
here