[Nix-dev] Rubygems and bundler

shea at shealevy.com shea at shealevy.com
Thu Mar 7 16:10:06 CET 2013


Hi Andrew,

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.

As for your problem number 2), I suspect that's a problem with 
GEM_PATH, but I'm not certain, if you could provide some steps to 
reproduce I might be able to help debug it.

~Shea

On 2013-03-07 09:58, Andrew Morsillo wrote:
> Thank you for the links Marc! The challenge posed by packaging
> systems like rubygems in nix is more clear to me now.
>
> I definitely still have a lot of learning to do about nix so I will
> study your solution closely.
>
> Andrew
>
> On Thu, Mar 7, 2013 at 7:46 AM, Marc Weber <marco-oweber at gmx.de> 
> wrote:
>
>> 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 [1]
>>
>> Comes closest.
>> See 
>> http://gitorious.org/nixpkgs-ruby-overlay/nixpkgs-ruby-overlay-specs 
>> [2]
>>
>> 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 
>> [3]
>>
>> If bundler could output a derivation description as found in
>> 
>> http://gitorious.org/nixpkgs-ruby-overlay/nixpkgs-ruby-overlay/blobs/master/default.nix 
>> [4]
>> (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
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev [5]
>
>
>
> Links:
> ------
> [1] http://gitorious.org/nixpkgs-ruby-overlay
> [2] 
> http://gitorious.org/nixpkgs-ruby-overlay/nixpkgs-ruby-overlay-specs
> [3]
> 
> http://gitorious.org/nixpkgs-ruby-overlay/nixpkgs-ruby-overlay/blobs/master/pkgs/defaults.nix
> [4]
> 
> http://gitorious.org/nixpkgs-ruby-overlay/nixpkgs-ruby-overlay/blobs/master/default.nix
> [5] http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev



More information about the nix-dev mailing list