2020-04-24 23:36:52 +00:00
|
|
|
{ elk7Version
|
2021-09-18 10:52:07 +00:00
|
|
|
, lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, jre_headless
|
2021-09-18 10:52:07 +00:00
|
|
|
, util-linux
|
|
|
|
, gnugrep
|
|
|
|
, coreutils
|
2020-04-24 23:36:52 +00:00
|
|
|
, autoPatchelfHook
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
|
|
|
info = splitString "-" stdenv.hostPlatform.system;
|
|
|
|
arch = elemAt info 0;
|
|
|
|
plat = elemAt info 1;
|
|
|
|
shas =
|
2021-12-06 16:07:01 +00:00
|
|
|
{
|
2021-12-19 01:06:50 +00:00
|
|
|
x86_64-linux = "1s16l95wc589cr69pfbgmkn9rkvxn6sd6jlbiqpm6p6iyxiaxd6c";
|
|
|
|
x86_64-darwin = "05h7pvq4pb816wgcymnfklp3w6sv54x6138v2infw5219dnk8pfs";
|
|
|
|
aarch64-linux = "0q4xnjzhlx1b2lkikca88qh9glfxaifsm419k2bxxlrfrx31zlkq";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
in
|
2021-12-06 16:07:01 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "elasticsearch";
|
2020-04-24 23:36:52 +00:00
|
|
|
version = elk7Version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-08-05 21:33:18 +00:00
|
|
|
url = "https://artifacts.elastic.co/downloads/elasticsearch/${pname}-${version}-${plat}-${arch}.tar.gz";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = shas.${stdenv.hostPlatform.system} or (throw "Unknown architecture");
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [ ./es-home-6.x.patch ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace bin/elasticsearch-env --replace \
|
|
|
|
"ES_CLASSPATH=\"\$ES_HOME/lib/*\"" \
|
|
|
|
"ES_CLASSPATH=\"$out/lib/*\""
|
|
|
|
|
|
|
|
substituteInPlace bin/elasticsearch-cli --replace \
|
|
|
|
"ES_CLASSPATH=\"\$ES_CLASSPATH:\$ES_HOME/\$additional_classpath_directory/*\"" \
|
|
|
|
"ES_CLASSPATH=\"\$ES_CLASSPATH:$out/\$additional_classpath_directory/*\""
|
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
|
|
|
|
|
|
|
|
buildInputs = [ jre_headless util-linux zlib ];
|
|
|
|
|
|
|
|
runtimeDependencies = [ zlib ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R bin config lib modules plugins $out
|
|
|
|
|
|
|
|
chmod +x $out/bin/*
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
substituteInPlace $out/bin/elasticsearch \
|
|
|
|
--replace 'bin/elasticsearch-keystore' "$out/bin/elasticsearch-keystore"
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/bin/elasticsearch \
|
2020-11-24 20:58:05 +00:00
|
|
|
--prefix PATH : "${makeBinPath [ util-linux coreutils gnugrep ]}" \
|
2020-04-24 23:36:52 +00:00
|
|
|
--set JAVA_HOME "${jre_headless}"
|
|
|
|
|
|
|
|
wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre_headless}"
|
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
passthru = { enableUnfree = true; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Open Source, Distributed, RESTful Search Engine";
|
2021-12-06 16:07:01 +00:00
|
|
|
license = licenses.elastic;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ apeschar basvandijk ];
|
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
}
|