2018-08-03 12:24:38 +02:00
|
|
|
{ elk6Version
|
|
|
|
, enableUnfree ? true
|
|
|
|
, stdenv
|
|
|
|
, makeWrapper
|
|
|
|
, fetchzip
|
|
|
|
, fetchurl
|
|
|
|
, nodejs
|
|
|
|
, coreutils
|
|
|
|
, which
|
|
|
|
}:
|
2014-09-15 11:33:07 +02:00
|
|
|
|
|
|
|
with stdenv.lib;
|
2016-09-25 21:40:15 +02:00
|
|
|
let
|
|
|
|
inherit (builtins) elemAt;
|
2018-08-20 21:11:29 +02:00
|
|
|
info = splitString "-" stdenv.hostPlatform.system;
|
2018-08-03 12:24:38 +02:00
|
|
|
arch = elemAt info 0;
|
2016-09-25 21:40:15 +02:00
|
|
|
plat = elemAt info 1;
|
2018-08-03 12:24:38 +02:00
|
|
|
shas =
|
|
|
|
if enableUnfree
|
|
|
|
then {
|
|
|
|
"x86_64-linux" = "1kk97ggpzmblhqm6cfd2sv5940f58h323xcyg6rba1njj7lzanv0";
|
|
|
|
"x86_64-darwin" = "1xvwffk8d8br92h0laf4b1m76kvki6cj0pbgcvirfcj1r70vk6c3";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
"x86_64-linux" = "0m81ki1v61gpwb3s6zf84azqrirlm9pdfx65g3xmvdp3d3wii5ly";
|
|
|
|
"x86_64-darwin" = "0zh9p6vsq1d0gh6ks7z6bh8sbhn6rm4jshjcfp3c9k7n2qa8vv9b";
|
|
|
|
};
|
|
|
|
|
|
|
|
# For the correct phantomjs version see:
|
|
|
|
# https://github.com/elastic/kibana/blob/master/x-pack/plugins/reporting/server/browsers/phantom/paths.js
|
|
|
|
phantomjs = rec {
|
|
|
|
name = "phantomjs-${version}-linux-x86_64";
|
|
|
|
version = "2.1.1";
|
|
|
|
src = fetchzip {
|
|
|
|
inherit name;
|
|
|
|
url = "https://github.com/Medium/phantomjs/releases/download/v${version}/${name}.tar.bz2";
|
|
|
|
sha256 = "0g2dqjzr2daz6rkd6shj6rrlw55z4167vqh7bxadl8jl6jk7zbfv";
|
|
|
|
};
|
2016-09-25 21:40:15 +02:00
|
|
|
};
|
2018-08-03 12:24:38 +02:00
|
|
|
|
2016-09-25 21:40:15 +02:00
|
|
|
in stdenv.mkDerivation rec {
|
2018-08-03 12:24:38 +02:00
|
|
|
name = "kibana-${optionalString (!enableUnfree) "oss-"}${version}";
|
|
|
|
version = elk6Version;
|
2014-09-15 11:33:07 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-08-03 12:24:38 +02:00
|
|
|
url = "https://artifacts.elastic.co/downloads/kibana/${name}-${plat}-${arch}.tar.gz";
|
2018-08-20 21:11:29 +02:00
|
|
|
sha256 = shas."${stdenv.hostPlatform.system}" or (throw "Unknown architecture");
|
2014-09-15 11:33:07 +02:00
|
|
|
};
|
|
|
|
|
2015-09-18 20:46:51 +02:00
|
|
|
buildInputs = [ makeWrapper ];
|
2014-10-14 19:05:23 +02:00
|
|
|
|
2014-09-15 11:33:07 +02:00
|
|
|
installPhase = ''
|
2015-09-18 20:46:51 +02:00
|
|
|
mkdir -p $out/libexec/kibana $out/bin
|
|
|
|
mv * $out/libexec/kibana/
|
|
|
|
rm -r $out/libexec/kibana/node
|
|
|
|
makeWrapper $out/libexec/kibana/bin/kibana $out/bin/kibana \
|
2016-08-23 00:06:51 +02:00
|
|
|
--prefix PATH : "${stdenv.lib.makeBinPath [ nodejs coreutils which ]}"
|
2016-02-13 15:01:45 +01:00
|
|
|
sed -i 's@NODE=.*@NODE=${nodejs}/bin/node@' $out/libexec/kibana/bin/kibana
|
2018-08-03 12:24:38 +02:00
|
|
|
'' +
|
|
|
|
# phantomjs is needed in the unfree version. When phantomjs doesn't exist in
|
|
|
|
# $out/libexec/kibana/data kibana will try to download and unpack it during
|
|
|
|
# runtime which will fail because the nix store is read-only. So we make sure
|
|
|
|
# it already exist in the nix store.
|
|
|
|
optionalString enableUnfree ''
|
|
|
|
ln -s ${phantomjs.src} $out/libexec/kibana/data/${phantomjs.name}
|
2014-09-15 11:33:07 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Visualize logs and time-stamped data";
|
|
|
|
homepage = http://www.elasticsearch.org/overview/kibana;
|
2018-08-03 12:24:38 +02:00
|
|
|
license = if enableUnfree then licenses.elastic else licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ offline rickynils basvandijk ];
|
2016-08-02 19:50:55 +02:00
|
|
|
platforms = with platforms; unix;
|
2014-09-15 11:33:07 +02:00
|
|
|
};
|
|
|
|
}
|