3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/search/elasticsearch/2.x.nix
2017-02-08 19:24:00 -05:00

44 lines
1.3 KiB
Nix

{ stdenv, fetchurl, makeWrapper, jre, utillinux, getopt }:
with stdenv.lib;
stdenv.mkDerivation rec {
version = "2.4.4";
name = "elasticsearch-${version}";
src = fetchurl {
url = "https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/${version}/${name}.tar.gz";
sha256 = "1qjq04sfqb35pf2xpvr8j5p27chfxpjp8ymrp1h5bfk5rbk9444q";
};
patches = [ ./es-home-2.x.patch ./es-classpath-2.x.patch ];
buildInputs = [ makeWrapper jre ] ++
(if (!stdenv.isDarwin) then [utillinux] else [getopt]);
installPhase = ''
mkdir -p $out
cp -R bin config lib modules $out
# don't want to have binary with name plugin
mv $out/bin/plugin $out/bin/elasticsearch-plugin
wrapProgram $out/bin/elasticsearch \
--prefix ES_CLASSPATH : "$out/lib/${name}.jar":"$out/lib/*" \
${if (!stdenv.isDarwin)
then ''--prefix PATH : "${utillinux}/bin/"''
else ''--prefix PATH : "${getopt}/bin"''} \
--set JAVA_HOME "${jre}"
wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre}"
'';
meta = {
description = "Open Source, Distributed, RESTful Search Engine";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = [
maintainers.offline
maintainers.markWot
];
};
}