2019-04-14 19:39:46 +00:00
|
|
|
{ elk7Version
|
2021-08-30 02:57:31 +00:00
|
|
|
, lib
|
|
|
|
, stdenv
|
2018-06-24 11:22:12 +00:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, jre_headless
|
2021-08-30 02:57:31 +00:00
|
|
|
, util-linux
|
|
|
|
, gnugrep
|
|
|
|
, coreutils
|
2018-06-24 11:22:12 +00:00
|
|
|
, autoPatchelfHook
|
|
|
|
, zlib
|
|
|
|
}:
|
2017-12-18 19:53:54 +00:00
|
|
|
|
2021-01-15 07:07:56 +00:00
|
|
|
with lib;
|
2019-04-14 19:39:46 +00:00
|
|
|
let
|
|
|
|
info = splitString "-" stdenv.hostPlatform.system;
|
|
|
|
arch = elemAt info 0;
|
|
|
|
plat = elemAt info 1;
|
|
|
|
shas =
|
2021-02-26 10:31:22 +00:00
|
|
|
{
|
2022-06-01 22:15:43 +00:00
|
|
|
x86_64-linux = "7281b79f2bf7421c2d71ab4eecdfd517b86b6788d1651dad315198c564284ea9";
|
|
|
|
x86_64-darwin = "6d2343171a0d384910312220aae3512f45e3d3d900557b736c139b8363a008e4";
|
|
|
|
aarch64-linux = "3153820d53a454513b534765fef68ce1f61a2dd92d4dae7428a1220bb3ce8fe5";
|
|
|
|
aarch64-darwin = "e62af7486c1041d3f1648646671d5c665e1abffd696cd2a5d96c2a5aaabe38f8";
|
2019-04-14 19:39:46 +00:00
|
|
|
};
|
|
|
|
in
|
2021-02-26 10:31:22 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "elasticsearch";
|
2019-04-14 19:39:46 +00:00
|
|
|
version = elk7Version;
|
2017-12-18 19:53:54 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-07-25 21:53:02 +00:00
|
|
|
url = "https://artifacts.elastic.co/downloads/elasticsearch/${pname}-${version}-${plat}-${arch}.tar.gz";
|
2019-09-08 23:38:31 +00:00
|
|
|
sha256 = shas.${stdenv.hostPlatform.system} or (throw "Unknown architecture");
|
2017-12-18 19:53:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [ ./es-home-6.x.patch ];
|
|
|
|
|
|
|
|
postPatch = ''
|
2018-11-29 16:10:15 +00:00
|
|
|
substituteInPlace bin/elasticsearch-env --replace \
|
2019-04-09 10:34:01 +00:00
|
|
|
"ES_CLASSPATH=\"\$ES_HOME/lib/*\"" \
|
2018-11-29 16:10:15 +00:00
|
|
|
"ES_CLASSPATH=\"$out/lib/*\""
|
|
|
|
|
|
|
|
substituteInPlace bin/elasticsearch-cli --replace \
|
2019-04-09 10:34:01 +00:00
|
|
|
"ES_CLASSPATH=\"\$ES_CLASSPATH:\$ES_HOME/\$additional_classpath_directory/*\"" \
|
|
|
|
"ES_CLASSPATH=\"\$ES_CLASSPATH:$out/\$additional_classpath_directory/*\""
|
2017-12-18 19:53:54 +00:00
|
|
|
'';
|
|
|
|
|
2022-03-16 12:00:28 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ]
|
|
|
|
++ lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook;
|
2021-02-26 10:31:22 +00:00
|
|
|
|
|
|
|
buildInputs = [ jre_headless util-linux zlib ];
|
|
|
|
|
|
|
|
runtimeDependencies = [ zlib ];
|
|
|
|
|
2017-12-18 19:53:54 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R bin config lib modules plugins $out
|
|
|
|
|
2019-04-14 19:39:46 +00:00
|
|
|
chmod +x $out/bin/*
|
2017-12-18 19:53:54 +00:00
|
|
|
|
2021-08-31 01:30:17 +00:00
|
|
|
substituteInPlace $out/bin/elasticsearch \
|
|
|
|
--replace 'bin/elasticsearch-keystore' "$out/bin/elasticsearch-keystore"
|
|
|
|
|
2017-12-18 19:53:54 +00:00
|
|
|
wrapProgram $out/bin/elasticsearch \
|
2020-11-24 15:29:28 +00:00
|
|
|
--prefix PATH : "${makeBinPath [ util-linux coreutils gnugrep ]}" \
|
2018-04-07 23:43:47 +00:00
|
|
|
--set JAVA_HOME "${jre_headless}"
|
2017-12-18 19:53:54 +00:00
|
|
|
|
|
|
|
wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre_headless}"
|
|
|
|
'';
|
|
|
|
|
2021-02-26 10:31:22 +00:00
|
|
|
passthru = { enableUnfree = true; };
|
2018-06-24 11:22:12 +00:00
|
|
|
|
2017-12-18 19:53:54 +00:00
|
|
|
meta = {
|
|
|
|
description = "Open Source, Distributed, RESTful Search Engine";
|
2022-06-16 23:40:08 +00:00
|
|
|
sourceProvenance = with lib.sourceTypes; [
|
|
|
|
binaryBytecode
|
|
|
|
binaryNativeCode
|
|
|
|
];
|
2021-02-26 10:31:22 +00:00
|
|
|
license = licenses.elastic;
|
2017-12-18 19:53:54 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ apeschar basvandijk ];
|
|
|
|
};
|
2021-02-26 10:31:22 +00:00
|
|
|
}
|