[Nix-dev] Announcing New Ruby Support

Cillian de Róiste cillian.deroiste at gmail.com
Tue Feb 10 23:05:49 CET 2015


2015-02-10 19:25 GMT+01:00 Cillian de Róiste <cillian.deroiste at gmail.com>:
>
> 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.

The second line has the word "gemspec", I commented it out and was
able to get further

I ran `bundler package --no-install --path vendor/bundle` which
successfully created lockfile.

>> 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

To avoid rebuilding the world I checked out 317d78d and tried to
install bundix from there. I had to patch the hash for bundix and
bundler [1], but then I was able to install bundix and create the
gemset.nix \o/

>>
>> 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:


I copied the example nix expression, changed the name and added it to
all-packages.nix to build it. All went quite well until I got the
following error:

    ...
    Installing liquid 3.0.1

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

        /nix/store/wdjnbdyrvsfbg245qyp3r7qwhlhxzd1c-ruby-1.9.3-p547/bin/ruby
-r ./siteconf20150210-115-km0s7e.rb extconf.rb
    creating Makefile

    make  clean
    building clean-static
    building clean

    make
    building lexer.o
    compiling lexer.c
    lexer.c: In function 'lex_one':
    lexer.c:143:5: error: implicit declaration of function
'rb_enc_raise' [-Werror=implicit-function-declaration]
         rb_enc_raise(utf8_encoding, cLiquidSyntaxError, "Unexpected
character %c", c);

IIUC it fails to find some ruby header file. Any tips on how to proceed?

Cheers,
Cillian


Patches [1]:

diff --git a/pkgs/development/interpreters/ruby/bundix/gemset.nix
b/pkgs/development/interpreters/ruby/bundix/gemset.nix
index a2c633f..a3e732c 100644
--- a/pkgs/development/interpreters/ruby/bundix/gemset.nix
+++ b/pkgs/development/interpreters/ruby/bundix/gemset.nix
@@ -6,7 +6,7 @@
       url = "https://github.com/cstrahan/bundix.git";
       rev = "5df25b11b5b86e636754d54c2a8859c7c6ec78c7";
       fetchSubmodules = false;
-      sha256 = "0334jsavpzkikcs7wrx7a3r0ilvr5vsnqd34lhc58b8cgvgll47p";
+      sha256 = "1iqx12y777v8gszggj25x0xcf6lzllx58lmv53x6zy3jmvfh4siv";
     };
     dependencies = [
       "thor"
diff --git a/pkgs/development/interpreters/ruby/bundler-head.nix
b/pkgs/development/interpreters/ruby/bundler-head.nix
index 2e8cfc8..43a5961 100644
--- a/pkgs/development/interpreters/ruby/bundler-head.nix
+++ b/pkgs/development/interpreters/ruby/bundler-head.nix
@@ -5,7 +5,7 @@ buildRubyGem {
   src = fetchgit {
     url = "https://github.com/bundler/bundler.git";
     rev = "a2343c9eabf5403d8ffcbca4dea33d18a60fc157";
-    sha256 = "1l4r55n1wzr817l225l6pm97li1mxg9icd8s51cpfihh91nkdz68";
+    sha256 = "1fywz0m3bb0fmcikhqbw9iaw67k29srwi8dllq6ni1cbm1xfyj46";
     leaveDotGit = true;
   };
   dontPatchShebangs = true;


-- 
NixOS: The Purely Functional Linux Distribution
http://nixos.org


More information about the nix-dev mailing list