-
Notifications
You must be signed in to change notification settings - Fork 9
/
es.nix
34 lines (26 loc) · 1.01 KB
/
es.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ stdenv, makeWrapper, writeScript, elasticsearch, homePath }:
stdenv.mkDerivation rec {
name = "es-local";
unpackPhase = " ";
configurePhase = " ";
buildPhase = " ";
checkPhase = " ";
initLocalESHome = writeScript "init-local-es-home" ''
#!/bin/bash
mkdir -p ${homePath}/bin
mkdir -p ${homePath}/data
mkdir -p ${homePath}/logs
test -e ${homePath}/config || (mkdir -p ${homePath}/config && install ${elasticsearch}/config/* ${homePath}/config)
mkdir -p ${homePath}/config/scripts
test -e ${homePath}/lib || ln -s ${elasticsearch}/lib ${homePath}/lib
test -e ${homePath}/modules || ln -s ${elasticsearch}/modules ${homePath}/modules
test -e ${homePath}/plugins || ln -s ${elasticsearch}/plugins ${homePath}/plugins
'';
buildInputs = [ makeWrapper ];
installPhase = ''
install -D ${elasticsearch}/bin/elasticsearch $out/bin/elasticsearch
wrapProgram $out/bin/elasticsearch \
--set ES_HOME ${homePath}
ln -s $initLocalESHome $out/bin/init-local-es-home
'';
}