1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs synced 2024-10-23 16:02:20 -04:00
nixpkgs/pkgs/development/interpreters/ruby/ruby-18.nix
Shea Levy 44c97e02f6 Move GEM_PATH part of rubygems' setup hook to ruby
Fixes #1413

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-26 18:38:10 -05:00

64 lines
1.6 KiB
Nix

{ stdenv, fetchurl
, zlib, zlibSupport ? true
, openssl, opensslSupport ? true
, gdbm, gdbmSupport ? true
, ncurses, readline, cursesSupport ? false
, groff, docSupport ? false
}:
let
op = stdenv.lib.optional;
ops = stdenv.lib.optionals;
in
stdenv.mkDerivation rec {
version = with passthru; "${majorVersion}.${minorVersion}-p${patchLevel}";
name = "ruby-${version}";
src = fetchurl {
url = "http://cache.ruby-lang.org/pub/ruby/1.8/${name}.tar.bz2";
sha256 = "b4e34703137f7bfb8761c4ea474f7438d6ccf440b3d35f39cc5e4d4e239c07e3";
};
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
NROFF = "${groff}/bin/nroff";
buildInputs = (ops cursesSupport [ ncurses readline ] )
++ (op docSupport groff )
++ (op zlibSupport zlib)
++ (op opensslSupport openssl)
++ (op gdbmSupport gdbm);
configureFlags = ["--enable-shared" "--enable-pthread"];
installFlags = stdenv.lib.optionalString docSupport "install-doc";
postInstall = ''
# Bundler tries to create this directory
mkdir -pv $out/${passthru.gemPath}
mkdir -p $out/nix-support
cat > $out/nix-support/setup-hook <<EOF
addGemPath() {
addToSearchPath GEM_PATH \$1/${passthru.gemPath}
}
envHooks+=(addGemPath)
EOF
'';
meta = {
license = "Ruby";
homepage = "http://www.ruby-lang.org/en/";
description = "The Ruby language";
};
passthru = rec {
majorVersion = "1.8";
minorVersion = "7";
patchLevel = "374";
libPath = "lib/ruby/${majorVersion}";
gemPath = "lib/ruby/gems/${majorVersion}";
};
}