[Nix-dev] Question regarding my attempt to set up a ruby environment.

Peter Jones mlists at pmade.com
Tue May 2 17:42:04 CEST 2017


Mustard Seed <supercriticalfluid at gmail.com> writes:
> I'm trying to use NixOS as a dev environment for Ruby. I found the
> following
>
> https://github.com/areina/nix-new-rails-app
>
> That's helped me have an idea of how to go about setting up a ruby project
> (I have almost zero ruby experience) but I am running into an issue on the
> third of the first four manual tasks prior to opening up the nix-shell.
>
> When I try to run
>
> nix-shell --command "rails new . --force --skip-bundle; bundler lock"
>
> it gets to the point in the screen shot (you can see such here in an issue
> I opened with the git repo
> https://github.com/areina/nix-new-rails-app/issues/1) and then NixOS logs me out.
>
> I'm at a bit of a loss as to where to go from here as I'm hitting some
> significant barriers with my limited understanding of Nix AND of Ruby.

I find that writing a default.nix file or a shell.nix file for each
project that I work on gives me the best results.

As an example, below are some files that I've hacked up.  I don't work
with Ruby that often anymore so my motivation to make these files better
isn't really there.

First, a function that uses its arguments to build a package/environment
for each application that I work on:

    https://github.com/pjones/nix-utils/blob/master/lib/ruby/default.nix

And here is an example application using that function:

    https://github.com/pjones/nix-utils/blob/master/envs/rfa/cltc-phoenix.nix

The way I use this is by running `nix-shell`, giving it the above file,
while in the directory of the application.  It drops me into a shell
that has everything I need to work on a Ruby/Rails application.

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code



More information about the nix-dev mailing list