[Nix-dev] Announcing New Ruby Support

Cillian de Róiste cillian.deroiste at gmail.com
Tue Feb 10 19:25:18 CET 2015


Hi!

I thought I'd try to package jekyll, but I've run into some trouble...

2015-01-22 5:29 GMT+01:00 Charles Strahan <charles.c.strahan at gmail.com>:

> To use the new system, first create (or copy over) a Gemfile describing the
> required gems.
>

I grabbed the Gemfile from the github repo:
$ wget https://raw.githubusercontent.com/jekyll/jekyll/master/Gemfile

Next, create a Gemfile.lock by running `bundler package --no-install` in the
> containing directory (this also creates two folders - vendor and .bundle -
> which you'll want to delete before committing).
>

I had first installed pkgs.bundler, which got me version 1.7.9, which
doesn't have the --no-install option which seems to have been added in 1.8.
I then installed pkgs.bundler_HEAD which also reports the version to be
1.7.9 but does have the --no-install option. However, I got stuck on the
next step:

$ bundler package --no-install
There are no gemspecs at /home/goibhniu/ruby/jekyll.

I'm afraid I know very little about ruby or gems etc., so any help/pointers
would be appreciated.

Thanks!
Cillian


Now, you'll need to dump the lockfile as a Nix expression. To do so, use
> Bundix
> in the target directory:
>
>   $(nix-build '<nixpkgs>' -A bundix)/bin/bundix
>
> That will drop a gemset.nix file in your current directory, which
> describes the
> sources for all of the gems and their respective SHAs.
>
> Finally, you'll need to use bundlerEnv to build the gems. The following
> example
> is how we package the sup mail reader:
>
>   { stdenv, lib, bundlerEnv, gpgme, ruby, ncurses, writeText, zlib, xapian
>   , pkgconfig, which }:
>
>   bundlerEnv {
>     name = "sup-0.20.0";
>
>     inherit ruby;
>     gemfile = ./Gemfile;
>     lockfile = ./Gemfile.lock;
>     gemset = ./gemset.nix;
>
>     # This is implicit:
>     #
>     #   gemConfig = defaultGemConfig;
>     #
>     # You could just as well do the following:
>     #
>     #   gemConfig.ncursesw = spec: {
>     #     buildInputs = [ ncurses ];
>     #     buildFlags = [
>     #       "--with-cflags=-I${ncurses}/include"
>     #       "--with-ldflags=-L${ncurses}/lib"
>     #     ];
>     #   };
>     #
>     # Where `spec` is the attributes of the corresponding gem,
>     # in case you wanted to make something predicated on version,
>     # for example.
>     #
>     # See default-gem-config.nix for more examples.
>
>     meta = with lib; {
>       description = "A curses threads-with-tags style email client";
>       homepage    = http://supmua.org;
>       license     = with licenses; gpl2;
>       maintainers = with maintainers; [ cstrahan lovek323 ];
>       platforms   = platforms.unix;
>     };
>   }
>
> And that's all there is to it!
>
> Enjoy,
>
> -Charles
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>


-- 
NixOS: The Purely Functional Linux Distribution
http://nixos.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150210/f5301338/attachment-0001.html 


More information about the nix-dev mailing list