depot/third_party/nixpkgs/pkgs/servers/search/opensearch/default.nix
Default email 5e7c2d6cef Project import generated by Copybara.
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
2023-10-09 21:29:22 +02:00

62 lines
1.6 KiB
Nix

{ coreutils
, fetchurl
, gnugrep
, jre_headless
, lib
, makeBinaryWrapper
, nixosTests
, stdenv
, stdenvNoCC
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "opensearch";
version = "2.10.0";
src = fetchurl {
url = "https://artifacts.opensearch.org/releases/bundle/opensearch/${finalAttrs.version}/opensearch-${finalAttrs.version}-linux-x64.tar.gz";
hash = "sha256-oJLxdXHn+fEp2ATWdyFRbfM/QebAWiT7cogxIwLrgfs=";
};
nativeBuildInputs = [
makeBinaryWrapper
];
buildInputs = [
jre_headless
];
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 [ gnugrep coreutils ]}" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$out/plugins/opensearch-knn/lib/" \
--set JAVA_HOME "${jre_headless}"
wrapProgram $out/bin/opensearch-plugin --set JAVA_HOME "${jre_headless}"
wrapProgram $out/bin/opensearch-cli --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;
maintainers = with lib.maintainers; [ shyim ];
platforms = lib.platforms.unix;
sourceProvenance = with lib.sourceTypes; [
binaryBytecode
binaryNativeCode
];
};
})