[Nix-dev] How to package Heroku Toolbelt?

Alex Berg chexxor at gmail.com
Mon Nov 18 09:08:06 CET 2013


Thanks for the idea Jonas. I gave it a try, and I finally got it working.
But, I encountered some problems on the way, so I want to ask here.

I am using Ruby 1.9, which includes "Rubygems" out-of-the-box, I believe.

    $ gem install heroku
    ERROR:  While executing gem ... (Gem::FilePermissionError)
            You don't have write permissions into the
/nix/store/m1mgqmkx23hyqr8sp1533x4mhcv6fpqf-ruby-1.9.3-p429/lib/ruby/gems/1.9.1
directory.

We can't install stuff into a Nix Store, so I must install Gems into a
directory which I own. I discovered I can override the default Gem location
by setting the "GEM_HOME" environment variable, so I chose my "home"
directory, which I own.

    $ export GEM_HOME=/home/chexxor/.gemrepo
    $ gem install heroku
    # <No problem>
    $ heroku
    # <Nothing. The PATH doesn't point there. How should I manage the PATH?>
    $  ~/.gemrepo/gems/heroku-3.0.1/bin/heroku
    # <Same "readline" error as from my Nix-packaged Heroku>

So, installing the "heroku" Gem produced the same result as installing the
"heroku" Nix package. But, I found a way to fix the issue.

    $ gem install rb-readline
    $ heroku
    # <Heroku command list - Success!>

How is "rb-readline" Gem different from the "readline" package which is
installed when Nix-packaged Ruby is installed? I read the docs, which say
that "rb-readline" is a Ruby implementation of the "readline" package,
which is written in C. The "rb-readline" package works easier across more
platforms. (Is this a bug in the "Ruby" Nix package?)

Some questions:

1) Where should NixOS users store Gems? I believe Gems are dependent on a
specific Ruby version, so we should ensure each Ruby version gets its own
set of Gems. No?
2) Does anybody else have this readline issue? Can we define this
"rb-readline" Gem as a dependency of the Ruby Nix package?






On Mon, Nov 18, 2013 at 6:59 AM, Jonas Pfenniger (zimbatm) <
zimbatm at zimbatm.com> wrote:

> Alternatively you could also just install the "heroku" and the "foreman"
> gem for the same effect.
> The toolbelt is really just a distribution of these gems with a bundled
> ruby interpreter, it's principally meant for OSes with a broken package
> management like OSX and Windows (they want to avoid support for
> mis-configured ruby installs).
>
>
> On 15 November 2013 07:24, Vladimír Čunát <vcunat at gmail.com> wrote:
>
>> On 11/15/2013 06:34 AM, Alex Berg wrote:
>>
>>> Now, another question. After I install the Heroku Toolbelt, the `heroku`
>>> command is available on the command-line. But, I can't run it because I
>>> haven't installed Ruby.
>>>
>>
>> That's because of not patching the shebangs. You are right that it's run
>> automatically, but you just need to add ruby to buildInputs, so it's found
>> by the patcher. (I confused this, direct running of patchShebangs is only
>> needed if the builders need to run scripts.)
>>
>> However, it still complains about some dependencies. I would just have to
>> guess how this is best done, as I don't know ruby. You can try looking at
>> other packages using it (git grep ruby), or hopefully someone with nix+ruby
>> experience will help (e.g. I saw ToDo on wiki from Marc Weber <
>> marco-oweber at gmx.de>).
>>
>>
>> Good luck!
>> Vlada
>>
>>
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20131118/db1c9c95/attachment.html 


More information about the nix-dev mailing list