3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/misc/kibana/default.nix

83 lines
2.7 KiB
Nix
Raw Normal View History

2018-08-03 11:24:38 +01:00
{ elk6Version
, enableUnfree ? true
, stdenv
, makeWrapper
, fetchzip
, fetchurl
, nodejs
, coreutils
, which
}:
with stdenv.lib;
let
inherit (builtins) elemAt;
info = splitString "-" stdenv.hostPlatform.system;
2018-08-03 11:24:38 +01:00
arch = elemAt info 0;
plat = elemAt info 1;
2018-08-03 11:24:38 +01:00
shas =
if enableUnfree
then {
2018-11-29 16:10:15 +00:00
"x86_64-linux" = "0lip4bj3jazv83gydw99dnp03cb0fd1p4z3lvpjbisgmqffbbg5v";
"x86_64-darwin" = "0hjdnqagcwbjhpcfyr6w0zmy4sjnx4fyp79czb0vp7dig5arnwm3";
2018-08-03 11:24:38 +01:00
}
else {
2018-11-29 16:10:15 +00:00
"x86_64-linux" = "1jybn4q7pz61iijzl85d948szlacfcbldn2nhhsb6063xwvf30sa";
"x86_64-darwin" = "1bl1h6hgp9l5cjq6pzj2x855wjaka8hbs0fn2c03lbzsc991dppr";
2018-08-03 11:24:38 +01:00
};
# 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";
};
};
2018-08-03 11:24:38 +01:00
in stdenv.mkDerivation rec {
2018-08-03 11:24:38 +01:00
name = "kibana-${optionalString (!enableUnfree) "oss-"}${version}";
version = elk6Version;
src = fetchurl {
2018-08-03 11:24:38 +01:00
url = "https://artifacts.elastic.co/downloads/kibana/${name}-${plat}-${arch}.tar.gz";
sha256 = shas."${stdenv.hostPlatform.system}" or (throw "Unknown architecture");
};
2018-11-29 16:10:15 +00:00
patches = [
# Kibana specifies it specifically needs nodejs 8.11.4 but nodejs in nixpkgs is at 8.12.0.
# The <nixpkgs/nixos/tests/elk.nix> test succeeds with this newer version so lets just
# disable the version check.
./disable-nodejs-version-check.patch
];
2015-09-18 19:46:51 +01:00
buildInputs = [ makeWrapper ];
2014-10-14 18:05:23 +01:00
installPhase = ''
2015-09-18 19:46:51 +01: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-22 23:06:51 +01:00
--prefix PATH : "${stdenv.lib.makeBinPath [ nodejs coreutils which ]}"
2016-02-13 14:01:45 +00:00
sed -i 's@NODE=.*@NODE=${nodejs}/bin/node@' $out/libexec/kibana/bin/kibana
2018-08-03 11:24:38 +01: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}
'';
meta = {
description = "Visualize logs and time-stamped data";
homepage = http://www.elasticsearch.org/overview/kibana;
2018-08-03 11:24:38 +01:00
license = if enableUnfree then licenses.elastic else licenses.asl20;
maintainers = with maintainers; [ offline rickynils basvandijk ];
platforms = with platforms; unix;
};
}