15 info = lib.splitString "-" stdenv.hostPlatform.system;
16 arch = lib.elemAt info 0;
17 plat = lib.elemAt info 1;
20 x86_64-linux = "sha512-OiWGRxaCdRxXuxE/W04v87ytzOeUEcHRjF5nyRkdqSbZSnLXUyKOYQ4fKmk4til0VBOaKZYId20XyPiu/XTXNw==";
21 x86_64-darwin = "sha512-V/vKYL96+M1lp7ZJlvuneRBePWZmucUANfUrFPMuq+fnUP4nN69RStLWcgwgt65EspFMBwKVyQbak4swV8rWxw==";
22 aarch64-linux = "sha512-fNgVRaIIGx01reNHOnGKhMOG1aYU7gC8HLpIESSbM3+9xO1q9IHIaL/ObI/w2RYj/lD22d7PAdX5N6Hd1pVSAA==";
23 aarch64-darwin = "sha512-DgexeyoxZ1YTPw9HjSUAM6eC8XtzIw7MY1WUVsIa8zl5j3RpCp25s3oI12BWefjYYCTjdtFDMsnoFSqZBabLig==";
26 stdenv.mkDerivation rec {
27 pname = "elasticsearch";
28 version = elk7Version;
31 url = "https://artifacts.elastic.co/downloads/elasticsearch/${pname}-${version}-${plat}-${arch}.tar.gz";
32 hash = hashes.${stdenv.hostPlatform.system} or (throw "Unknown architecture");
35 patches = [ ./es-home-6.x.patch ];
38 substituteInPlace bin/elasticsearch-env --replace \
39 "ES_CLASSPATH=\"\$ES_HOME/lib/*\"" \
40 "ES_CLASSPATH=\"$out/lib/*\""
42 substituteInPlace bin/elasticsearch-cli --replace \
43 "ES_CLASSPATH=\"\$ES_CLASSPATH:\$ES_HOME/\$additional_classpath_directory/*\"" \
44 "ES_CLASSPATH=\"\$ES_CLASSPATH:$out/\$additional_classpath_directory/*\""
47 nativeBuildInputs = [ makeWrapper ]
48 ++ lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook;
50 buildInputs = [ jre_headless util-linux zlib ];
52 runtimeDependencies = [ zlib ];
56 cp -R bin config lib modules plugins $out
60 substituteInPlace $out/bin/elasticsearch \
61 --replace 'bin/elasticsearch-keystore' "$out/bin/elasticsearch-keystore"
63 wrapProgram $out/bin/elasticsearch \
64 --prefix PATH : "${lib.makeBinPath [ util-linux coreutils gnugrep ]}" \
65 --set JAVA_HOME "${jre_headless}"
67 wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre_headless}"
70 passthru = { enableUnfree = true; };
73 description = "Open Source, Distributed, RESTful Search Engine";
74 sourceProvenance = with sourceTypes; [
78 license = licenses.elastic20;
79 platforms = platforms.unix;
80 maintainers = with maintainers; [ apeschar basvandijk ];