nixpkgs-suyu/pkgs/servers/search/elasticsearch/5.x.nix
2017-06-26 08:47:28 +02:00

44 lines
1.2 KiB
Nix

{ stdenv, fetchurl, elk5Version, makeWrapper, jre, utillinux, getopt }:
with stdenv.lib;
stdenv.mkDerivation rec {
version = elk5Version;
name = "elasticsearch-${version}";
src = fetchurl {
url = "https://artifacts.elastic.co/downloads/elasticsearch/${name}.tar.gz";
sha256 = "0l31i6dp3q6d6gqsnji1ym0abqphzf1yxswwn4s3na8s216i41h2";
};
patches = [ ./es-home-5.x.patch ./es-classpath-5.x.patch ];
buildInputs = [ makeWrapper jre ] ++
(if (!stdenv.isDarwin) then [utillinux] else [getopt]);
installPhase = ''
mkdir -p $out
cp -R bin config lib modules plugins $out
chmod -x $out/bin/*.*
wrapProgram $out/bin/elasticsearch \
--prefix ES_CLASSPATH : "$out/lib/*" \
${if (!stdenv.isDarwin)
then ''--prefix PATH : "${utillinux}/bin/"''
else ''--prefix PATH : "${getopt}/bin"''} \
--set JAVA_HOME "${jre}" \
--set ES_JVM_OPTIONS "$out/config/jvm.options"
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.apeschar
];
};
}