diff --git a/pkgs/servers/search/opensearch/default.nix b/pkgs/servers/search/opensearch/default.nix new file mode 100644 index 000000000000..da1e739b4a2a --- /dev/null +++ b/pkgs/servers/search/opensearch/default.nix @@ -0,0 +1,51 @@ +{ lib +, stdenvNoCC +, fetchurl +, makeWrapper +, jre_headless +, util-linux +, gnugrep +, coreutils +, autoPatchelfHook +, zlib +}: + +stdenvNoCC.mkDerivation rec { + pname = "opensearch"; + version = "2.5.0"; + + src = fetchurl { + url = "https://artifacts.opensearch.org/releases/bundle/opensearch/${version}/opensearch-${version}-linux-x64.tar.gz"; + hash = "sha256-WPD5StVBb/hK+kP/1wkQQBKRQma/uaP+8ULeIFUBL1U="; + }; + + 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 ]}" \ + --set JAVA_HOME "${jre_headless}" + + wrapProgram $out/bin/opensearch-plugin --set JAVA_HOME "${jre_headless}" + + runHook postInstall + ''; + + 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 ]; + }; +} diff --git a/pkgs/servers/search/opensearch/opensearch-home-fix.patch b/pkgs/servers/search/opensearch/opensearch-home-fix.patch new file mode 100644 index 000000000000..25d0130d6d9b --- /dev/null +++ b/pkgs/servers/search/opensearch/opensearch-home-fix.patch @@ -0,0 +1,26 @@ +diff -Naur a/bin/opensearch-env b/bin/opensearch-env +--- a/bin/opensearch-env 2017-12-12 13:31:51.000000000 +0100 ++++ b/bin/opensearch-env 2017-12-18 19:51:12.282809695 +0100 +@@ -19,18 +19,10 @@ + fi + done + +-# determine OpenSearch home; to do this, we strip from the path until we find +-# bin, and then strip bin (there is an assumption here that there is no nested +-# directory under bin also named bin) +-OPENSEARCH_HOME=`dirname "$SCRIPT"` +- +-# now make OPENSEARCH_HOME absolute +-OPENSEARCH_HOME=`cd "$OPENSEARCH_HOME"; pwd` +- +-while [ "`basename "$OPENSEARCH_HOME"`" != "bin" ]; do +- OPENSEARCH_HOME=`dirname "$OPENSEARCH_HOME"` +-done +-OPENSEARCH_HOME=`dirname "$OPENSEARCH_HOME"` ++if [ -z "$OPENSEARCH_HOME" ]; then ++ echo "You must set the OPENSEARCH_HOME var" >&2 ++ exit 1 ++fi + + # now set the classpath + OPENSEARCH_CLASSPATH="$OPENSEARCH_HOME/lib/*" \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8c5cae91ff1c..62eb435f0272 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34812,6 +34812,8 @@ with pkgs; openrct2 = callPackage ../games/openrct2 { }; + opensearch = callPackage ../servers/search/opensearch { }; + osu-lazer = callPackage ../games/osu-lazer { }; osu-lazer-bin = callPackage ../games/osu-lazer/bin.nix { };