diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/servers/search')
8 files changed, 514 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/6.x.nix b/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/6.x.nix new file mode 100644 index 000000000000..04e81fe150a9 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/6.x.nix @@ -0,0 +1,72 @@ +{ elk6Version +, enableUnfree ? true +, stdenv +, fetchurl +, makeWrapper +, jre_headless +, utillinux, gnugrep, coreutils +, autoPatchelfHook +, zlib +}: + +with stdenv.lib; + +stdenv.mkDerivation (rec { + version = elk6Version; + name = "elasticsearch-${optionalString (!enableUnfree) "oss-"}${version}"; + + src = fetchurl { + url = "https://artifacts.elastic.co/downloads/elasticsearch/${name}.tar.gz"; + sha256 = + if enableUnfree + then "09dy3iyzk460vra6na6vk7d3mzpbv4cl0pl7kjmybxy947j7hh42" + else "0s04xz3j4psyhawvy503sp2nl5s0gswmpd9wfvwnavgcrr23wk39"; + }; + + patches = [ ./es-home-6.x.patch ]; + + postPatch = '' + substituteInPlace bin/elasticsearch-env --replace \ + "ES_CLASSPATH=\"\$ES_HOME/lib/*\"" \ + "ES_CLASSPATH=\"$out/lib/*\"" + + substituteInPlace bin/elasticsearch-cli --replace \ + "ES_CLASSPATH=\"\$ES_CLASSPATH:\$ES_HOME/\$additional_classpath_directory/*\"" \ + "ES_CLASSPATH=\"\$ES_CLASSPATH:$out/\$additional_classpath_directory/*\"" + ''; + + buildInputs = [ makeWrapper jre_headless utillinux ] + ++ optional enableUnfree zlib; + + installPhase = '' + mkdir -p $out + cp -R bin config lib modules plugins $out + + chmod -x $out/bin/*.* + + wrapProgram $out/bin/elasticsearch \ + --prefix PATH : "${makeBinPath [ utillinux 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"; + license = if enableUnfree then licenses.elastic else licenses.asl20; + platforms = platforms.unix; + maintainers = with maintainers; [ apeschar basvandijk ]; + }; +} // optionalAttrs enableUnfree { + dontPatchELF = true; + nativeBuildInputs = [ autoPatchelfHook ]; + runtimeDependencies = [ zlib ]; + postFixup = '' + 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 + ''; +}) diff --git a/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/7.x.nix b/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/7.x.nix new file mode 100644 index 000000000000..73a947066bfa --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/7.x.nix @@ -0,0 +1,83 @@ +{ elk7Version +, enableUnfree ? true +, stdenv +, fetchurl +, makeWrapper +, jre_headless +, utillinux, gnugrep, coreutils +, autoPatchelfHook +, zlib +}: + +with stdenv.lib; +let + info = splitString "-" stdenv.hostPlatform.system; + arch = elemAt info 0; + plat = elemAt info 1; + shas = + if enableUnfree + then { + x86_64-linux = "1s27bzx5y8vcd95qrw6av3fhyxb45219x9ahwaxa2cygmbpighrp"; + x86_64-darwin = "1ia3byir3i5qaarmcaysrg3dhnxjmxnf0m0kzyf61g9aiy87gb7q"; + } + else { + x86_64-linux = "005i7d7ag10qkn7bkx7md50iihvcvc84hay2j94wvsm7yghhbmi3"; + x86_64-darwin = "01f81720rbzdqc0g1xymhz2lflldfbnb0rh7mpki99pss28vj9sh"; + }; +in +stdenv.mkDerivation (rec { + version = elk7Version; + name = "elasticsearch-${optionalString (!enableUnfree) "oss-"}${version}"; + + src = fetchurl { + url = "https://artifacts.elastic.co/downloads/elasticsearch/${name}-${plat}-${arch}.tar.gz"; + sha256 = shas.${stdenv.hostPlatform.system} or (throw "Unknown architecture"); + }; + + patches = [ ./es-home-6.x.patch ]; + + postPatch = '' + substituteInPlace bin/elasticsearch-env --replace \ + "ES_CLASSPATH=\"\$ES_HOME/lib/*\"" \ + "ES_CLASSPATH=\"$out/lib/*\"" + + substituteInPlace bin/elasticsearch-cli --replace \ + "ES_CLASSPATH=\"\$ES_CLASSPATH:\$ES_HOME/\$additional_classpath_directory/*\"" \ + "ES_CLASSPATH=\"\$ES_CLASSPATH:$out/\$additional_classpath_directory/*\"" + ''; + + buildInputs = [ makeWrapper jre_headless utillinux ] + ++ optional enableUnfree zlib; + + installPhase = '' + mkdir -p $out + cp -R bin config lib modules plugins $out + + chmod +x $out/bin/* + + wrapProgram $out/bin/elasticsearch \ + --prefix PATH : "${makeBinPath [ utillinux coreutils gnugrep ]}" \ + --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"; + license = if enableUnfree then licenses.elastic else licenses.asl20; + platforms = platforms.unix; + maintainers = with maintainers; [ apeschar basvandijk ]; + }; +} // optionalAttrs enableUnfree { + dontPatchELF = true; + nativeBuildInputs = [ autoPatchelfHook ]; + runtimeDependencies = [ zlib ]; + postFixup = '' + 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 + ''; +}) diff --git a/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/es-home-6.x.patch b/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/es-home-6.x.patch new file mode 100644 index 000000000000..aba8d396a69c --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/es-home-6.x.patch @@ -0,0 +1,26 @@ +diff -Naur a/bin/elasticsearch-env b/bin/elasticsearch-env +--- a/bin/elasticsearch-env 2017-12-12 13:31:51.000000000 +0100 ++++ b/bin/elasticsearch-env 2017-12-18 19:51:12.282809695 +0100 +@@ -19,18 +19,10 @@ + fi + done + +-# determine Elasticsearch 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) +-ES_HOME=`dirname "$SCRIPT"` +- +-# now make ES_HOME absolute +-ES_HOME=`cd "$ES_HOME"; pwd` +- +-while [ "`basename "$ES_HOME"`" != "bin" ]; do +- ES_HOME=`dirname "$ES_HOME"` +-done +-ES_HOME=`dirname "$ES_HOME"` ++if [ -z "$ES_HOME" ]; then ++ echo "You must set the ES_HOME var" >&2 ++ exit 1 ++fi + + # now set the classpath + ES_CLASSPATH="$ES_HOME/lib/*" diff --git a/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/plugins.nix b/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/plugins.nix new file mode 100644 index 000000000000..846fb33000bb --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/servers/search/elasticsearch/plugins.nix @@ -0,0 +1,174 @@ +{ lib, stdenv, fetchurl, unzip, elasticsearch }: + +let + esVersion = elasticsearch.version; + + esPlugin = a@{ + pluginName, + installPhase ? '' + mkdir -p $out/config + mkdir -p $out/plugins + ln -s ${elasticsearch}/lib $out/lib + ES_HOME=$out ${elasticsearch}/bin/elasticsearch-plugin install --batch -v file://$src + rm $out/lib + '', + ... + }: + stdenv.mkDerivation (a // { + inherit installPhase; + pname = "elasticsearch-${pluginName}"; + dontUnpack = true; + # Work around the "unpacker appears to have produced no directories" + # case that happens when the archive doesn't have a subdirectory. + setSourceRoot = "sourceRoot=$(pwd)"; + buildInputs = [ unzip ]; + meta = a.meta // { + platforms = elasticsearch.meta.platforms; + maintainers = (a.meta.maintainers or []) ++ (with lib.maintainers; [ offline ]); + }; + }); +in { + + analysis-icu = esPlugin rec { + name = "elasticsearch-analysis-icu-${version}"; + pluginName = "analysis-icu"; + version = esVersion; + src = fetchurl { + url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip"; + sha256 = + if version == "7.5.1" then "0v6ynbk34g7pl9cwy8ga8bk1my18jb6pc3pqbjl8p93w38219vi6" + else if version == "6.8.3" then "0vbaqyj0lfy3ijl1c9h92b0nh605h5mjs57bk2zhycdvbw5sx2lv" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with stdenv.lib; { + homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/analysis-icu"; + description = "The ICU Analysis plugin integrates the Lucene ICU module into elasticsearch"; + license = licenses.asl20; + }; + }; + + analysis-lemmagen = esPlugin rec { + pluginName = "analysis-lemmagen"; + version = esVersion; + src = fetchurl { + url = "https://github.com/vhyza/elasticsearch-${pluginName}/releases/download/v${version}/elasticsearch-${pluginName}-${version}-plugin.zip"; + sha256 = + if version == "7.5.1" then "0js8b9a9ma797448m3sy92qxbwziix8gkcka7hf17dqrb9k29v61" + else if version == "6.8.3" then "12bshvp01pp2lgwd0cn9l58axg8gdimsh4g9wfllxi1bdpv4cy53" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with lib; { + homepage = "https://github.com/vhyza/elasticsearch-analysis-lemmagen"; + description = "LemmaGen Analysis plugin provides jLemmaGen lemmatizer as Elasticsearch token filter"; + license = licenses.asl20; + }; + }; + + analysis-phonetic = esPlugin rec { + pluginName = "analysis-phonetic"; + version = esVersion; + src = fetchurl { + url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip"; + sha256 = + if version == "7.5.1" then "0znmbdf99bli4kvyb3vxr5x48yb6n64nl38gpa63iqsv3nlbi0hp" + else if version == "6.8.3" then "0ggdhf7w50bxsffmcznrjy14b578fps0f8arg3v54qvj94v9jc37" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with lib; { + homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/analysis-phonetic"; + description = "The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch"; + license = licenses.asl20; + }; + }; + + discovery-ec2 = esPlugin rec { + pluginName = "discovery-ec2"; + version = esVersion; + src = fetchurl { + url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip"; + sha256 = + if version == "7.5.1" then "09wl2bpng4xx384xns960rymnm64b5zn2cb1sp25n85pd0isp4p2" + else if version == "6.8.3" then "0pmffz761dqjpvmkl7i7xsyw1iyyspqpddxp89rjsznfc9pak5im" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with lib; { + homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/discovery-ec2"; + description = "The EC2 discovery plugin uses the AWS API for unicast discovery."; + license = licenses.asl20; + }; + }; + + ingest-attachment = esPlugin rec { + pluginName = "ingest-attachment"; + version = esVersion; + src = fetchurl { + url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip"; + sha256 = + if version == "7.5.1" then "0hhwxkjlkw1yv5sp6pdn5k1y8bdv4mnmb6nby1z4367mig6rm8v9" + else if version == "6.8.3" then "0kfr4i2rcwinjn31xrc2piicasjanaqcgnbif9xc7lnak2nnzmll" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with lib; { + homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/ingest-attachment"; + description = "Ingest processor that uses Apache Tika to extract contents"; + license = licenses.asl20; + }; + }; + + repository-s3 = esPlugin rec { + pluginName = "repository-s3"; + version = esVersion; + src = fetchurl { + url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${esVersion}.zip"; + sha256 = + if version == "7.5.1" then "1j1rgbha5lh0a02h55zqc5qn0mvvi16l2m5r8lmaswp97px056v9" + else if version == "6.8.3" then "1mm6hj2m1db68n81rzsvlw6nisflr5ikzk5zv9nmk0z641n5vh1x" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with lib; { + homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/repository-s3"; + description = "The S3 repository plugin adds support for using AWS S3 as a repository for Snapshot/Restore."; + license = licenses.asl20; + }; + }; + + repository-gcs = esPlugin rec { + pluginName = "repository-gcs"; + version = esVersion; + src = fetchurl { + url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${esVersion}.zip"; + sha256 = + if version == "7.5.1" then "15g438zpxrcmsgddwmk3sccy92ha90cyq9c61kcw1q84wfi0a7jl" + else if version == "6.8.3" then "1s2klpvnhpkrk53p64zbga3b66czi7h1a13f58kfn2cn0zfavnbk" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with lib; { + homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/repository-gcs"; + description = "The GCS repository plugin adds support for using Google Cloud Storage as a repository for Snapshot/Restore."; + license = licenses.asl20; + }; + }; + + search-guard = let + majorVersion = lib.head (builtins.splitVersion esVersion); + in esPlugin rec { + pluginName = "search-guard"; + version = + # https://docs.search-guard.com/latest/search-guard-versions + if esVersion == "7.5.1" then "${esVersion}-38.0.0" + else if esVersion == "6.8.3" then "${esVersion}-25.5" + else throw "unsupported version ${esVersion} for plugin ${pluginName}"; + src = fetchurl { + url = "mirror://maven/com/floragunn/${pluginName}-${majorVersion}/${version}/${pluginName}-${majorVersion}-${version}.zip"; + sha256 = + if version == "7.5.1-38.0.0" then "1a1wp9wrmz6ji2rnpk0b9jqnp86w0w0z8sb48giyc1gzcy1ra9yh" + else if version == "6.8.3-25.5" then "0a7ys9qinc0fjyka03cx9rv0pm7wnvslk234zv5vrphkrj52s1cb" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with lib; { + homepage = "https://search-guard.com"; + description = "Elasticsearch plugin that offers encryption, authentication, and authorisation. "; + license = licenses.asl20; + }; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/servers/search/groonga/default.nix b/infra/libkookie/nixpkgs/pkgs/servers/search/groonga/default.nix new file mode 100644 index 000000000000..a1fd39152075 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/servers/search/groonga/default.nix @@ -0,0 +1,42 @@ +{ stdenv, fetchurl, mecab, kytea, libedit, pkgconfig +, suggestSupport ? false, zeromq, libevent, msgpack +, lz4Support ? false, lz4 +, zlibSupport ? false, zlib +}: + +stdenv.mkDerivation rec { + + pname = "groonga"; + version = "10.0.6"; + + src = fetchurl { + url = "https://packages.groonga.org/source/groonga/${pname}-${version}.tar.gz"; + sha256 = "1q3xx6jc967nj7h8gvnrqxn8657dn3qy9j802rjzcg6iwlpjack9"; + }; + + buildInputs = with stdenv.lib; + [ pkgconfig mecab kytea libedit ] + ++ optional lz4Support lz4 + ++ optional zlibSupport zlib + ++ optionals suggestSupport [ zeromq libevent msgpack ]; + + configureFlags = with stdenv.lib; + optional zlibSupport "--with-zlib" + ++ optional lz4Support "--with-lz4"; + + doInstallCheck = true; + installCheckPhase = "$out/bin/groonga --version"; + + meta = with stdenv.lib; { + homepage = "https://groonga.org/"; + description = "An open-source fulltext search engine and column store"; + license = licenses.lgpl21; + maintainers = [ maintainers.ericsagnes ]; + platforms = platforms.unix; + longDescription = '' + Groonga is an open-source fulltext search engine and column store. + It lets you write high-performance applications that requires fulltext search. + ''; + }; + +} diff --git a/infra/libkookie/nixpkgs/pkgs/servers/search/meilisearch/default.nix b/infra/libkookie/nixpkgs/pkgs/servers/search/meilisearch/default.nix new file mode 100644 index 000000000000..f2484dffa636 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/servers/search/meilisearch/default.nix @@ -0,0 +1,29 @@ +{ stdenv +, rustPlatform +, fetchFromGitHub +, IOKit +, Security +}: + +rustPlatform.buildRustPackage rec { + pname = "meilisearch"; + version = "0.9.0"; + + src = fetchFromGitHub { + owner = "meilisearch"; + repo = "MeiliSearch"; + rev = "v${version}"; + sha256 = "00i5vsbcyrbsvhr5n1b3pxa87v0kfw6pg931i2kzyf4wh021k6sw"; + }; + + cargoSha256 = "0axjygk8a7cykpa5skk4a6mkm8rndkr76l10h3z3gjdc88b17qcz"; + + buildInputs = stdenv.lib.optionals stdenv.isDarwin [ IOKit Security ]; + + meta = with stdenv.lib; { + description = "Ultra relevant and instant full-text search API"; + homepage = "https://meilisearch.com/"; + license = licenses.mit; + maintainers = with maintainers; [ filalex77 ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/servers/search/solr/default.nix b/infra/libkookie/nixpkgs/pkgs/servers/search/solr/default.nix new file mode 100644 index 000000000000..b5390d1537d2 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/servers/search/solr/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchurl, jre, makeWrapper, nixosTests }: + +stdenv.mkDerivation rec { + pname = "solr"; + version = "8.6.1"; + + src = fetchurl { + url = "mirror://apache/lucene/${pname}/${version}/${pname}-${version}.tgz"; + sha256 = "0ds6zjsnwgpcmivzi7d6yqdmyn2mhf3k8g7xp26yfpm7f12gpq4g"; + }; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out $out/bin + + cp -r bin/solr bin/post $out/bin/ + cp -r contrib $out/ + cp -r dist $out/ + cp -r example $out/ + cp -r server $out/ + + wrapProgram $out/bin/solr --set JAVA_HOME "${jre}" + wrapProgram $out/bin/post --set JAVA_HOME "${jre}" + ''; + + passthru.tests = { + inherit (nixosTests) solr; + }; + + meta = with stdenv.lib; { + homepage = "https://lucene.apache.org/solr/"; + description = "Open source enterprise search platform from the Apache Lucene project"; + license = licenses.asl20; + platforms = platforms.all; + maintainers = with maintainers; [ domenkozar aanderse ]; + }; + +} diff --git a/infra/libkookie/nixpkgs/pkgs/servers/search/sphinxsearch/default.nix b/infra/libkookie/nixpkgs/pkgs/servers/search/sphinxsearch/default.nix new file mode 100644 index 000000000000..47547f07fb49 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/servers/search/sphinxsearch/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchurl, pkg-config, expat, libmysqlclient, + enableXmlpipe2 ? false, + enableMysql ? true +}: + +stdenv.mkDerivation rec { + pname = "sphinxsearch"; + version = "2.2.11"; + + src = fetchurl { + url = "http://sphinxsearch.com/files/sphinx-${version}-release.tar.gz"; + sha256 = "1aa1mh32y019j8s3sjzn4vwi0xn83dwgl685jnbgh51k16gh6qk6"; + }; + + enableParallelBuilding = true; + + configureFlags = [ + "--program-prefix=sphinxsearch-" + "--enable-id64" + ] ++ stdenv.lib.optionals (!enableMysql) [ + "--without-mysql" + ]; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = stdenv.lib.optionals enableMysql [ + libmysqlclient + ] ++ stdenv.lib.optionals enableXmlpipe2 [ + expat + ]; + + CXXFLAGS = with stdenv.lib; concatStringsSep " " (optionals stdenv.isDarwin [ + # see upstream bug: http://sphinxsearch.com/bugs/view.php?id=2578 + # workaround for "error: invalid suffix on literal + "-Wno-reserved-user-defined-literal" + # workaround for "error: non-constant-expression cannot be narrowed from type 'long' to 'int'" + "-Wno-c++11-narrowing" + ]); + + meta = { + description = "An open source full text search server"; + homepage = "http://sphinxsearch.com"; + license = stdenv.lib.licenses.gpl2; + platforms = stdenv.lib.platforms.all; + maintainers = with stdenv.lib.maintainers; [ ederoyd46 valodim ]; + }; +} |