[Nix-dev] nix + rubygems + sinatra
Jim Pick
jim at jimpick.com
Tue Mar 3 20:50:21 CET 2009
On 3/2/09 11:16 PM, Pjotr Prins wrote:
> On Mon, Mar 02, 2009 at 07:17:59PM -0800, Jim Pick wrote:
>> I'd actually like to come up with an automated way of generating nix
>> expressions from Ruby gems, if that is possible.
>
> There are several possibilities to package gems for Nix (likewise
> eggs for Python and packages for R, Perl etc.).
>
> 1- Generating Nix expressions from gem definition - like you have
> done really using a wrapper:
> - Pro: scope for automated generation of packages
> - Pro: seamless integration of interpreter/gem dependencies
> - Con: 'gem install package' does not work
> - Con: potentially lots of work for every dependency
> - Con: problems with non-pure Ruby gems
> - Con: maintenance nightmare for thousands of gems (BAD)
>
> 2- Installing gems in user land (current 'solution')
> - Pro: gems are installed in ~/.gems with user permissions
> - Con: no version control (BAD)
> - Con: no conflict control (hey, we are Nix, right?!)
>
> 3- Have gem work with ruby in Nix profile (current 'solution')
> - Pro: works with right installation permissions
> - Con: makes Nix Ruby package inconsistent - package installs in
> Ruby directory /nix/store/ruby-afd980... (BAD)
>
> 4- Change 'gem' package controller to support Nix
> - Pro: support 'gem install package' out of the box
> - Pro: automatically creates a Nix package for every gem
> - Pro: automatically share compiled gems
> - Pro: automatically support multiple Rubies (1.8, 1.9)
> - Con: we need to hack and maintain the gem code
> - Con: this needs to be done for eggs, R, cpan etc.
>
> Personally I think (4) is really the way to go. Not easy, but
> supporting existing gems will make Nix user friendly for everyone
> using Ruby gems and provide a consistent state. I'll be happy to help
> out moving this along.
>
> Pj.
>
Nice breakdown.
I think (4) is nice to have. I think that in order for (4) to work, it
would have to generate expressions just as in (1).
I would like to start by manually figuring out how to represent some of
the more popular gems as Nix expressions. After that, it would be nice
to figure out how to automate the generation of the Nix expressions with
some tool (eg. a modified "gem" command, or a new tool).
I am interested in using these hand-built or generated ruby gem nix
expressions with NixOS for system-wide configuration. I don't want to
have to script the user-oriented nix-env and/or gem tools at install
time -- I just want to plug the Ruby gem nix expressions into the nix
expression that builds the complete system image.
The way I added new Nix expressions into nixpkgs was by modifying
nixpkgs/pkgs/top-level/all-packages.nix. Does anybody have any
suggestions on how to make that a bit more modular so that Nix
expressions automatically generated by a tool could be "plugged in"?
Cheers,
- Jim
More information about the nix-dev
mailing list