summary refs log tree commit diff
path: root/pkgs/servers/search
diff options
context:
space:
mode:
authorAndrew Martin <andrew.thaddeus@gmail.com>2017-02-08 19:24:00 -0500
committerAndrew Martin <andrew.thaddeus@gmail.com>2017-02-08 19:24:00 -0500
commit02bbf843be37f382ec53c0cb4904a22ea9311eb8 (patch)
tree4c5a43c3ca5dc8a4ea6b358f70493653ae13d991 /pkgs/servers/search
parent3e7dffd2b355d37678cc7109803eea412bef5b28 (diff)
downloadnixlib-02bbf843be37f382ec53c0cb4904a22ea9311eb8.tar
nixlib-02bbf843be37f382ec53c0cb4904a22ea9311eb8.tar.gz
nixlib-02bbf843be37f382ec53c0cb4904a22ea9311eb8.tar.bz2
nixlib-02bbf843be37f382ec53c0cb4904a22ea9311eb8.tar.lz
nixlib-02bbf843be37f382ec53c0cb4904a22ea9311eb8.tar.xz
nixlib-02bbf843be37f382ec53c0cb4904a22ea9311eb8.tar.zst
nixlib-02bbf843be37f382ec53c0cb4904a22ea9311eb8.zip
set elasticsearch classpath to nix store
Diffstat (limited to 'pkgs/servers/search')
-rw-r--r--pkgs/servers/search/elasticsearch/2.x.nix6
-rw-r--r--pkgs/servers/search/elasticsearch/es-classpath-2.x.patch38
2 files changed, 42 insertions, 2 deletions
diff --git a/pkgs/servers/search/elasticsearch/2.x.nix b/pkgs/servers/search/elasticsearch/2.x.nix
index 35b6ee92cdcd..30beec7b873d 100644
--- a/pkgs/servers/search/elasticsearch/2.x.nix
+++ b/pkgs/servers/search/elasticsearch/2.x.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "1qjq04sfqb35pf2xpvr8j5p27chfxpjp8ymrp1h5bfk5rbk9444q";
   };
 
-  patches = [ ./es-home-2.x.patch ];
+  patches = [ ./es-home-2.x.patch ./es-classpath-2.x.patch ];
 
   buildInputs = [ makeWrapper jre ] ++
     (if (!stdenv.isDarwin) then [utillinux] else [getopt]);
@@ -22,7 +22,9 @@ stdenv.mkDerivation rec {
 
     # don't want to have binary with name plugin
     mv $out/bin/plugin $out/bin/elasticsearch-plugin
-    wrapProgram $out/bin/elasticsearch ${if (!stdenv.isDarwin)
+    wrapProgram $out/bin/elasticsearch \
+      --prefix ES_CLASSPATH : "$out/lib/${name}.jar":"$out/lib/*" \
+      ${if (!stdenv.isDarwin)
         then ''--prefix PATH : "${utillinux}/bin/"''
         else ''--prefix PATH : "${getopt}/bin"''} \
       --set JAVA_HOME "${jre}"
diff --git a/pkgs/servers/search/elasticsearch/es-classpath-2.x.patch b/pkgs/servers/search/elasticsearch/es-classpath-2.x.patch
new file mode 100644
index 000000000000..46a3f0be71b7
--- /dev/null
+++ b/pkgs/servers/search/elasticsearch/es-classpath-2.x.patch
@@ -0,0 +1,38 @@
+diff -rupN a/bin/elasticsearch b/bin/elasticsearch
+--- a/bin/elasticsearch	2017-02-08 18:32:28.000298543 -0500
++++ b/bin/elasticsearch	2017-02-08 19:10:45.692916675 -0500
+@@ -81,12 +81,7 @@ ES_HOME=`cd "$ES_HOME"; pwd`
+ # If an include wasn't specified in the environment, then search for one...
+ if [ "x$ES_INCLUDE" = "x" ]; then
+     # Locations (in order) to use when searching for an include file.
+-    for include in /usr/share/elasticsearch/elasticsearch.in.sh \
+-                   /usr/local/share/elasticsearch/elasticsearch.in.sh \
+-                   /opt/elasticsearch/elasticsearch.in.sh \
+-                   ~/.elasticsearch.in.sh \
+-                   "$ES_HOME/bin/elasticsearch.in.sh" \
+-                   "`dirname "$0"`"/elasticsearch.in.sh; do
++    for include in "`dirname "$0"`"/elasticsearch.in.sh; do
+         if [ -r "$include" ]; then
+             . "$include"
+             break
+diff -rupN a/bin/elasticsearch.in.sh b/bin/elasticsearch.in.sh
+--- a/bin/elasticsearch.in.sh	2017-02-08 18:32:28.000298543 -0500
++++ b/bin/elasticsearch.in.sh	2017-02-08 18:33:46.816634599 -0500
+@@ -1,17 +1,5 @@
+ #!/bin/sh
+ 
+-# check in case a user was using this mechanism
+-if [ "x$ES_CLASSPATH" != "x" ]; then
+-    cat >&2 << EOF
+-Error: Don't modify the classpath with ES_CLASSPATH. Best is to add
+-additional elements via the plugin mechanism, or if code must really be
+-added to the main classpath, add jars to lib/ (unsupported).
+-EOF
+-    exit 1
+-fi
+-
+-ES_CLASSPATH="$ES_HOME/lib/elasticsearch-2.4.4.jar:$ES_HOME/lib/*"
+-
+ if [ "x$ES_MIN_MEM" = "x" ]; then
+     ES_MIN_MEM=256m
+ fi