2018-06-24 11:22:12 +00:00
|
|
|
{ elk6Version
|
|
|
|
, enableUnfree ? true
|
2021-01-15 07:07:56 +00:00
|
|
|
, lib, stdenv
|
2018-06-24 11:22:12 +00:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, jre_headless
|
2020-11-24 15:29:28 +00:00
|
|
|
, util-linux, gnugrep, coreutils
|
2022-11-28 20:55:47 +00:00
|
|
|
, libxcrypt
|
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;
|
2017-12-18 19:53:54 +00:00
|
|
|
|
2018-06-24 11:22:12 +00:00
|
|
|
stdenv.mkDerivation (rec {
|
2017-12-18 19:53:54 +00:00
|
|
|
version = elk6Version;
|
2021-07-25 21:53:02 +00:00
|
|
|
pname = "elasticsearch${optionalString (!enableUnfree) "-oss"}";
|
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}.tar.gz";
|
2018-06-24 11:22:12 +00:00
|
|
|
sha256 =
|
|
|
|
if enableUnfree
|
2021-12-16 15:20:52 +00:00
|
|
|
then "1hkcgqsrnnx3zjpgar4424mxfaxrx0zbrp7n7n0dlbhphshwnkmd"
|
|
|
|
else "1pglg60aigy31xmpfchnxcc04nd18zwc3av4m0kyp00yk5mnlyqm";
|
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
|
|
|
'';
|
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ jre_headless util-linux ]
|
2022-12-08 22:26:13 +00:00
|
|
|
++ optionals enableUnfree [ zlib libxcrypt ];
|
2017-12-18 19:53:54 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R bin config lib modules plugins $out
|
|
|
|
|
|
|
|
chmod -x $out/bin/*.*
|
|
|
|
|
|
|
|
wrapProgram $out/bin/elasticsearch \
|
2020-11-24 15:29:28 +00:00
|
|
|
--prefix PATH : "${makeBinPath [ util-linux gnugrep coreutils ]}" \
|
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}"
|
|
|
|
'';
|
|
|
|
|
2018-06-24 11:22:12 +00:00
|
|
|
passthru = { inherit enableUnfree; };
|
|
|
|
|
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 ];
|
2018-06-24 11:22:12 +00:00
|
|
|
license = if enableUnfree then licenses.elastic else licenses.asl20;
|
2017-12-18 19:53:54 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ apeschar basvandijk ];
|
|
|
|
};
|
2018-06-24 11:22:12 +00:00
|
|
|
} // optionalAttrs enableUnfree {
|
|
|
|
dontPatchELF = true;
|
2022-03-22 17:59:05 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ]
|
|
|
|
++ optional stdenv.isLinux autoPatchelfHook;
|
2018-06-24 11:22:12 +00:00
|
|
|
runtimeDependencies = [ zlib ];
|
2022-03-22 17:59:05 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
2018-12-02 14:54:20 +00:00
|
|
|
for exe in $(find $out/modules/x-pack-ml/platform/linux-x86_64/bin -executable -type f); do
|
2018-06-24 11:22:12 +00:00
|
|
|
echo "patching $exe..."
|
|
|
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$exe"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
})
|