[Nix-dev] Rubygems and bundler

Marc Weber marco-oweber at gmx.de
Thu Mar 7 16:23:45 CET 2013


Excerpts from shea's message of Thu Mar 07 16:10:06 +0100 2013:
> I disagree with Marc's assessment. It's not true that gems are "not at 
> all" handled, gem nix works perfectly well (and can do gems with native 
> extensions fine, see e.g. rubyLibs.ffi), and IMO Marc's overlay 
> solutions are very over-complicated and unnecessary for what we actually 
> want to get done. I've run rails applications on NixOS setups in the 
> past and all worked well.

shea, you forget that it was me first writing the first version of gem
nix command. I know what I'm talking about - and I know why I
implemented the alternative.

"gem nix" is based on gem, not bundler. It may work, but for each
target app you have to rerun "gem nix" and create different sets of
dependencies. It does work - no doubt. The question is whether its
satisfying.

So it might be enough to have "rails running". But bundler is about
"fixing versions once and forever" till somebody runs the risk "updating
packages".

If you use genarted.nix you're out of control. If you extend bundler and
make it generate a package description which can be understood by code -
your app will be running fine forever (unless rubyforge drops packages).

I think we all agree that neither solution is perfect or satisfying.
My personal problem is that I'm not even satisfied with bundler.

So IMHO the true fix would be enhance bundler, then integrate this with
nix somehow. (That's on my todo list, but probaly will also stay there
for quite a while ..)

But of course that's only my view. And the best solution depends on the
use case.


> solutions are very over-complicated and unnecessary for what we actually 
Don't think so. I'm using this general purpose ruby env satisfying most
of my needs, and it doesn't look over complicated to me:

    rubyCollection =
      let ro = (pkgs.overlay "ruby");
      in ro.rubyEnv19 {
          p = {
            "ruby-debug-base19" = [["=" "0.11.25" ]];
          };

          names = [ 
            "rake" "bundler" "escape"
            "rspec"
            "bundler"
            "addressable"
            "mechanize" "nokogiri"
            "sass"
            "mechanize"
            "selenium-webdriver"
            "json"
            "sequel"
            "mysql"

            "livereload"
            "guard"

            ];
      };

You can add it to your ~/.nixpkgs/config.nix and be done.
However the same problem occurs unless you fix every version (which
bundler is about).

So in any case some pieces are still missing.

Marc Weber


More information about the nix-dev mailing list