[Nix-dev] Using bundlerEnv to create a rails development environment
ml+nixos at 6x9.fr
ml+nixos at 6x9.fr
Tue Apr 7 07:23:46 CEST 2015
Hello,
I am trying to use bundlerEnv to create a development environment I'll
use with nix-shell in the context of a rails application.
When I am launching nix-shell, I would like the following to happen:
- having all the needed gems my application depend on installed
- start any dependent services (databases for example) until the shell
is gone
Currently I have the following `default.nix` in my test dev folder:
-----------------------------------------------------------------------
with (import <nixpkgs> {});
let
project_name = "myproject";
ruby = pkgs.ruby_2_2_0;
env = bundlerEnv {
name = project_name;
inherit ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
};
in
stdenv.mkDerivation {
name = project_name;
src = null;
buildInputs = [ env postgresql ];
shellHook = ''
set -e;
export PGDATA="/var/dev-srv/pg-${project_name}"
export PATH=${env}/bin:$PATH
export GEM_HOME=${env}/lib
if [ ! -d $PGDATA ]; then
initdb
fi
if [ $autostart-postgres ]; then
pg_ctl -D $PGDATA -l ~/code/myproject/log/pg.log start
trap 'pg_ctl -D $PGDATA stop' EXIT
fi
'';
}
-----------------------------------------------------------------------
Which is basically a tentative to smach together multiple stuff I found
for other development environment and bundlerEnv.
This start and stop the postgresql database when I go in nix-shell, but
it does not load all the gems correctly (they are installed, but not all
available to ruby). This is what happen when i call rake in the
nix-shell:
-----------------------------------------------------------------------
Could not find i18n-0.7.0 in any of the sources
Run `bundle install` to install missing gems.
-----------------------------------------------------------------------
Note that I am a total noob when it come to Nix currently, so it does
not surprise me that this is not working!
Can somebody help me on this?
Best regards,
--
Mayeu a.k.a Matthieu
http://6x9.fr
GPG: A016 F2D8 0472 1186 1B33 A419 22B1 0496 B00D A693
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150407/fcf84088/attachment.bin
More information about the nix-dev
mailing list