2011-01-21 09:24:52 +01:00
|
|
|
{stdenv, fetchurl, writeScript, makeWrapper, rubygems, ruby,
|
|
|
|
ncurses, xapianBindings, sqlite, libxml2, libxslt, libffi, zlib, libuuid}:
|
|
|
|
|
|
|
|
let
|
|
|
|
gemsGenerated = (import ./gems-generated.nix) gemsWithVersions;
|
|
|
|
patchUsrBinEnv = writeScript "path-usr-bin-env" ''
|
|
|
|
#!/bin/sh
|
|
|
|
set -x
|
|
|
|
echo "==================="
|
|
|
|
find "$1" -type f -name "*.rb" | xargs sed -i "s@/usr/bin/env@$(type -p env)@g"
|
|
|
|
find "$1" -type f -name "*.mk" | xargs sed -i "s@/usr/bin/env@$(type -p env)@g"
|
|
|
|
'';
|
|
|
|
patches = {
|
|
|
|
sup = {
|
|
|
|
buildInputs = [ ncurses xapianBindings gems.ncursesw ];
|
|
|
|
};
|
|
|
|
sqlite3_ruby = { propagatedBuildInputs = [ sqlite ]; };
|
|
|
|
rails = {
|
|
|
|
gemFlags = "--no-ri --no-rdoc";
|
|
|
|
propagatedBuildInputs = [ gems.mime_types gems.rake ];
|
|
|
|
};
|
|
|
|
ncurses = { buildInputs = [ ncurses ]; };
|
|
|
|
ncursesw = { buildInputs = [ ncurses ]; };
|
|
|
|
nokogiri = {
|
|
|
|
buildFlags=["--with-xml2-dir=${libxml2} --with-xml2-include=${libxml2}/include/libxml2"
|
|
|
|
"--with-xslt-dir=${libxslt}" ];
|
|
|
|
};
|
2010-01-15 20:35:06 +01:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
ffi = {
|
|
|
|
postUnpack = "onetuh";
|
|
|
|
propagatedBuildInputs = [ gems.rake ];
|
|
|
|
buildFlags=["--with-ffi-dir=${libffi}"];
|
|
|
|
NIX_POST_EXTRACT_FILES_HOOK = patchUsrBinEnv;
|
|
|
|
};
|
2010-04-12 20:48:38 +02:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
xrefresh_server =
|
|
|
|
let patch = fetchurl {
|
|
|
|
url = "http://mawercer.de/~nix/xrefresh.diff.gz";
|
|
|
|
sha256 = "1f7bnmn1pgkmkml0ms15m5lx880hq2sxy7vsddb3sbzm7n1yyicq";
|
2010-04-12 20:48:38 +02:00
|
|
|
};
|
2011-01-21 09:24:52 +01:00
|
|
|
in {
|
|
|
|
propagatedBuildInputs = [ gems.rb_inotify ];
|
|
|
|
|
|
|
|
# monitor implementation for Linux
|
|
|
|
postInstall = ''
|
|
|
|
cd $out/${ruby.gemPath}/gems/*
|
|
|
|
zcat ${patch} | patch -p 1
|
|
|
|
'';
|
2009-06-30 16:29:20 +02:00
|
|
|
};
|
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
xapian_full = {
|
|
|
|
buildInputs = [ gems.rake zlib libuuid ];
|
|
|
|
gemFlags = "--no-rdoc --no-ri";
|
|
|
|
};
|
2010-09-08 11:56:53 +02:00
|
|
|
};
|
2011-01-21 09:24:52 +01:00
|
|
|
gemDefaults = { name, basename, requiredGems, sha256, meta }:
|
|
|
|
{
|
|
|
|
buildInputs = [rubygems ruby makeWrapper];
|
|
|
|
unpackPhase = ":";
|
|
|
|
configurePhase=":";
|
|
|
|
bulidPhase=":";
|
2010-09-08 11:56:53 +02:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://rubygems.org/downloads/${name}.gem";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
2010-09-08 11:56:53 +02:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
name = "ruby-${name}";
|
2010-01-15 20:35:06 +01:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
propagatedBuildInputs = requiredGems;
|
|
|
|
inherit meta;
|
2010-09-08 11:56:53 +02:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
installPhase = ''
|
|
|
|
export HOME=$TMP/home; mkdir -pv "$HOME"
|
2010-01-15 20:35:06 +01:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
gem install -V --ignore-dependencies \
|
|
|
|
-i "$out/${ruby.gemPath}" -n "$out/bin" "$src" $gemFlags -- $buildFlags
|
|
|
|
rm -frv $out/${ruby.gemPath}/cache # don't keep the .gem file here
|
2010-09-08 11:56:53 +02:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
addToSearchPath GEM_PATH $out/${ruby.gemPath}
|
2010-09-08 11:56:53 +02:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
for prog in $out/bin/*; do
|
|
|
|
wrapProgram "$prog" \
|
|
|
|
--prefix GEM_PATH : "$GEM_PATH" \
|
|
|
|
--prefix RUBYLIB : "${rubygems}/lib" \
|
|
|
|
--set RUBYOPT 'rubygems'
|
|
|
|
done
|
2010-09-08 11:56:59 +02:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
for prog in $out/gems/*/bin/*; do
|
|
|
|
[[ -e "$out/bin/$(basename $prog)" ]]
|
|
|
|
done
|
2010-04-12 21:23:14 +02:00
|
|
|
|
2011-01-21 09:24:52 +01:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
gem = aName: a@{ name, basename, requiredGems, sha256, meta }:
|
|
|
|
stdenv.mkDerivation (removeAttrs (stdenv.lib.mergeAttrsByFuncDefaults
|
|
|
|
[
|
|
|
|
(gemDefaults a)
|
|
|
|
(stdenv.lib.maybeAttr name {} patches)
|
|
|
|
(stdenv.lib.maybeAttr basename {} patches)
|
|
|
|
]
|
|
|
|
) ["mergeAttrBy"]);
|
|
|
|
gemsWithVersions = stdenv.lib.mapAttrs gem gemsGenerated.gems;
|
|
|
|
gems = gemsWithVersions // gemsGenerated.aliases;
|
|
|
|
in
|
|
|
|
gems
|