nixpkgs/pkgs/servers/search/elasticsearch/6.x.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
2.3 KiB
Nix
Raw Normal View History

{ elk6Version
, enableUnfree ? true
2021-01-15 07:07:56 +00:00
, lib, stdenv
, fetchurl
, makeWrapper
, jre_headless
2020-11-24 15:29:28 +00:00
, util-linux, gnugrep, coreutils
, libxcrypt
, autoPatchelfHook
, zlib
}:
2021-01-15 07:07:56 +00:00
with lib;
stdenv.mkDerivation (rec {
version = elk6Version;
pname = "elasticsearch${optionalString (!enableUnfree) "-oss"}";
src = fetchurl {
url = "https://artifacts.elastic.co/downloads/elasticsearch/${pname}-${version}.tar.gz";
sha256 =
if enableUnfree
then "1hkcgqsrnnx3zjpgar4424mxfaxrx0zbrp7n7n0dlbhphshwnkmd"
else "1pglg60aigy31xmpfchnxcc04nd18zwc3av4m0kyp00yk5mnlyqm";
};
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/*\""
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ jre_headless util-linux ]
++ optionals enableUnfree [ zlib libxcrypt ];
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 ]}" \
--set JAVA_HOME "${jre_headless}"
wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre_headless}"
'';
passthru = { inherit enableUnfree; };
meta = {
description = "Open Source, Distributed, RESTful Search Engine";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = if enableUnfree then licenses.elastic else licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ apeschar basvandijk ];
};
} // optionalAttrs enableUnfree {
dontPatchELF = true;
nativeBuildInputs = [ makeWrapper ]
++ optional stdenv.isLinux autoPatchelfHook;
runtimeDependencies = [ zlib ];
postFixup = lib.optionalString stdenv.isLinux ''
for exe in $(find $out/modules/x-pack-ml/platform/linux-x86_64/bin -executable -type f); do
echo "patching $exe..."
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$exe"
done
'';
})