2023-02-16 17:41:37 +00:00
|
|
|
{ lib
|
2023-03-08 16:32:21 +00:00
|
|
|
, stdenv
|
2023-02-16 17:41:37 +00:00
|
|
|
, stdenvNoCC
|
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, jre_headless
|
|
|
|
, util-linux
|
|
|
|
, gnugrep
|
|
|
|
, coreutils
|
|
|
|
, autoPatchelfHook
|
|
|
|
, zlib
|
|
|
|
, nixosTests
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenvNoCC.mkDerivation rec {
|
|
|
|
pname = "opensearch";
|
2023-03-08 16:32:21 +00:00
|
|
|
version = "2.6.0";
|
2023-02-16 17:41:37 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://artifacts.opensearch.org/releases/bundle/opensearch/${version}/opensearch-${version}-linux-x64.tar.gz";
|
2023-03-08 16:32:21 +00:00
|
|
|
hash = "sha256-qJrgWF8JCR4jmnF239gaiRr4Y7Tin0TyYjzxd1Q4Wko";
|
2023-02-16 17:41:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ jre_headless util-linux ];
|
|
|
|
patches = [./opensearch-home-fix.patch ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R bin config lib modules plugins $out
|
|
|
|
|
|
|
|
substituteInPlace $out/bin/opensearch \
|
|
|
|
--replace 'bin/opensearch-keystore' "$out/bin/opensearch-keystore"
|
|
|
|
|
|
|
|
wrapProgram $out/bin/opensearch \
|
|
|
|
--prefix PATH : "${lib.makeBinPath [ util-linux gnugrep coreutils ]}" \
|
2023-03-08 16:32:21 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$out/plugins/opensearch-knn/lib/" \
|
2023-02-16 17:41:37 +00:00
|
|
|
--set JAVA_HOME "${jre_headless}"
|
|
|
|
|
|
|
|
wrapProgram $out/bin/opensearch-plugin --set JAVA_HOME "${jre_headless}"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests = nixosTests.opensearch;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Open Source, Distributed, RESTful Search Engine";
|
|
|
|
homepage = "https://github.com/opensearch-project/OpenSearch";
|
|
|
|
license = lib.licenses.asl20;
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
maintainers = with lib.maintainers; [ shyim ];
|
|
|
|
};
|
|
|
|
}
|