[Nix-dev] Rubygems and bundler
Marc Weber
marco-oweber at gmx.de
Thu Mar 7 13:46:54 CET 2013
Excerpts from Andrew Morsillo's message of Thu Mar 07 05:18:24 +0100 2013:
> I am trying to get an environment set up to run my rails application on
> nixos but I am confused about how rubygems/bundler is handled. I have read
It is not at all.
http://gitorious.org/nixpkgs-ruby-overlay
Comes closest.
See http://gitorious.org/nixpkgs-ruby-overlay/nixpkgs-ruby-overlay-specs
bundler is broken by design because it doesn't check versions of
dependencies level > 2.
Eg A > B > C - then version constraints for C will not be checked.
> over rubygems.nix and see that I could install all my dependencies by
> generating nix expression for them with "gem nix" but trying to do this has
> lead me to two problems:
> 1) "gem nix" does not appear to be able to handle gems that require
> building native extensions.
You can pass paths to includes and library directories somehow, but its
a mess.
=> see tarruby, mysql packages etc.
http://gitorious.org/nixpkgs-ruby-overlay/nixpkgs-ruby-overlay/blobs/master/pkgs/defaults.nix
If bundler could output a derivation description as found in
http://gitorious.org/nixpkgs-ruby-overlay/nixpkgs-ruby-overlay/blobs/master/default.nix
(see rails there to see some examples)
You'd be pretty much done - except that its awkward to get 40.000
package descriptions if you use only 20 of them.
I'd like to fix this by implementing a http api in nix, so that data can
be fetched from trusted servers (and then can be cached)
> What is the best way to handle gems with native extensions?
There is no "perfect way".
> Why can't bundler read the existing gems I have installed into the nix
> store?
You don't want a reply to this because you know it: Nobody implemented
it.
> Are others running complex rails applications on nixos and if so what is
> your setup?
Don't think so.
> I can run my application by setting up a custom build environment and
> installing rvm in my home directory, but I would rather do it the "nixos
> way" if possible.
rvm is stateful and a mess (compared to nix). I had in mind making it
nix compatible. Then I couldn't spend enough time on it.
Marc Weber
More information about the nix-dev
mailing list