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
|
|
|
{
|
2023-05-24 13:37:59 +00:00
|
|
|
x86_64-linux = "7a2013e43c7fc39e86a31a733cc74c587ef2bba0c013f95ce874f98b488a4f8f0e6fb254a1eedd5c0b0e210aed9a0195f7358fa9653c890e234413ff93190807";
|
|
|
|
x86_64-darwin = "e6f49e7c0f59e260b3e3d43e57375c9352976c4f51118005e3a9127f41b59f95e51ea158cd318e99410e6d98464ea1f84432c905d12a84b8f68b2ce35905f944";
|
|
|
|
aarch64-linux = "f2790f49b79c381246bbf87431919452af93aa4fd8aa6bc9c1f9031e7ed5d9c649f5bab867c28a7d1602e2285d3f4a5f78f809ac05744b02ad67d68610bb677d";
|
|
|
|
aarch64-darwin = "75b66b60650bb82dc517f4a594fa40816d3becb92bf3b349f3e8324cc6b297c8bcacebc08e7661891fd4ede03a099fea56c1509291804dd03345717c36564172";
|
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";
|
2023-05-24 13:37:59 +00:00
|
|
|
sha512 = shas.${stdenv.hostPlatform.system} or (throw "Unknown architecture");
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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/*\""
|
|
|
|
'';
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ]
|
|
|
|
++ lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook;
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
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";
|
2022-07-14 12:49:19 +00:00
|
|
|
sourceProvenance = with lib.sourceTypes; [
|
|
|
|
binaryBytecode
|
|
|
|
binaryNativeCode
|
|
|
|
];
|
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
|
|
|
}
|