[Nix-dev] per-project nix-shell for Ruby (Gemfile) projects?
Linus Arver
linusarver at gmail.com
Thu May 14 18:09:20 CEST 2015
On Tue, May 12, 2015 at 11:03:58PM +0200, Rok Garbas wrote:
> hi linus,
>
> you might find a "recent" thread on mailing list interesting.
> http://article.gmane.org/gmane.linux.distributions.nixos/15702
Hello Rok!
I did read that thread, but I can't really understand how to adapt it
for installing a single gem and making it available in the current
environment. The example in there is for building the sup mail reader; I
followed the instructions and packaged the 'minitest' gem, but even
though I install it with
nix-env -i minitest
and see it in my 'nix-env -q' like this:
minitest-5.6.1
the Ruby script I wrote that uses it cannot find it.
What I want to do is write a single Ruby file (which defines a Class or
Module) that depends on a particular gem. I need, e.g.,
require 'foo'
class Bar
...
end
to work.
How do NixOS users go about this? On Arch Linux, I use Rbenv to download
various Ruby versions, and then use 'bundle install' in a project's root
folder containing the Gemfile to get all the gems installed for the
currently active Ruby version.
I realize that I can just do the same thing on Nix, but I get a feeling
that the current tooling allows us to use the Nix mechanisms to achieve
the same thing (and avoid, e.g., re-downloading Rails or activerecord
every single time we start a new Rails project).
Cheers,
Linus
More information about the nix-dev
mailing list