3
0
Fork 0
forked from mirrors/nixpkgs

kibana: update default version to v6

This commit is contained in:
Jörg Thalheim 2018-08-03 11:24:38 +01:00
parent 13db07a092
commit c3055ab3ce
4 changed files with 50 additions and 130 deletions

View file

@ -5,43 +5,7 @@ with lib;
let let
cfg = config.services.kibana; cfg = config.services.kibana;
atLeast54 = versionAtLeast (builtins.parseDrvName cfg.package.name).version "5.4"; cfgFile = pkgs.writeText "kibana.json" (builtins.toJSON (
cfgFile = if atLeast54 then cfgFile5 else cfgFile4;
cfgFile4 = pkgs.writeText "kibana.json" (builtins.toJSON (
(filterAttrsRecursive (n: v: v != null) ({
host = cfg.listenAddress;
port = cfg.port;
ssl_cert_file = cfg.cert;
ssl_key_file = cfg.key;
kibana_index = cfg.index;
default_app_id = cfg.defaultAppId;
elasticsearch_url = cfg.elasticsearch.url;
kibana_elasticsearch_username = cfg.elasticsearch.username;
kibana_elasticsearch_password = cfg.elasticsearch.password;
kibana_elasticsearch_cert = cfg.elasticsearch.cert;
kibana_elasticsearch_key = cfg.elasticsearch.key;
ca = cfg.elasticsearch.ca;
bundled_plugin_ids = [
"plugins/dashboard/index"
"plugins/discover/index"
"plugins/doc/index"
"plugins/kibana/index"
"plugins/markdown_vis/index"
"plugins/metric_vis/index"
"plugins/settings/index"
"plugins/table_vis/index"
"plugins/vis_types/index"
"plugins/visualize/index"
];
} // cfg.extraConf)
)));
cfgFile5 = pkgs.writeText "kibana.json" (builtins.toJSON (
(filterAttrsRecursive (n: v: v != null) ({ (filterAttrsRecursive (n: v: v != null) ({
server.host = cfg.listenAddress; server.host = cfg.listenAddress;
server.port = cfg.port; server.port = cfg.port;

View file

@ -1,75 +0,0 @@
{ elk6Version
, enableUnfree ? true
, stdenv
, makeWrapper
, fetchzip
, fetchurl
, nodejs
, coreutils
, which
}:
with stdenv.lib;
let
inherit (builtins) elemAt;
info = splitString "-" stdenv.system;
arch = elemAt info 0;
plat = elemAt info 1;
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";
};
};
in stdenv.mkDerivation rec {
name = "kibana-${optionalString (!enableUnfree) "oss-"}${version}";
version = elk6Version;
src = fetchurl {
url = "https://artifacts.elastic.co/downloads/kibana/${name}-${plat}-${arch}.tar.gz";
sha256 = shas."${stdenv.system}" or (throw "Unknown architecture");
};
buildInputs = [ makeWrapper ];
installPhase = ''
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 \
--prefix PATH : "${stdenv.lib.makeBinPath [ nodejs coreutils which ]}"
sed -i 's@NODE=.*@NODE=${nodejs}/bin/node@' $out/libexec/kibana/bin/kibana
'' +
# 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;
license = if enableUnfree then licenses.elastic else licenses.asl20;
maintainers = with maintainers; [ offline rickynils basvandijk ];
platforms = with platforms; unix;
};
}

View file

@ -1,26 +1,49 @@
{ stdenv, makeWrapper, fetchurl, nodejs, coreutils, which }: { elk6Version
, enableUnfree ? true
, stdenv
, makeWrapper
, fetchzip
, fetchurl
, nodejs
, coreutils
, which
}:
with stdenv.lib; with stdenv.lib;
let let
inherit (builtins) elemAt; inherit (builtins) elemAt;
archOverrides = {
"i686" = "x86";
};
info = splitString "-" stdenv.system; info = splitString "-" stdenv.system;
arch = (elemAt info 0); arch = elemAt info 0;
elasticArch = archOverrides."${arch}" or arch;
plat = elemAt info 1; plat = elemAt info 1;
shas = { shas =
"x86_64-linux" = "1wnnrhhpgc58s09p99cmi8r2jmwsd5lmh2inb0k8nmizz5v1sjz0"; if enableUnfree
"i686-linux" = "0sdx59jlfrf7r9793xpn2vxaxjdczgn3qfw8yny03dcs6fjaxi2y"; then {
"x86_64-darwin" = "0rmp536kn001g52lxngpj6x6d0j3qj0r11d4djbz7h6s5ml03kza"; "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";
};
}; };
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
name = "kibana-${version}"; name = "kibana-${optionalString (!enableUnfree) "oss-"}${version}";
version = "4.6.5"; version = elk6Version;
src = fetchurl { src = fetchurl {
url = "https://download.elastic.co/kibana/kibana/${name}-${plat}-${elasticArch}.tar.gz"; url = "https://artifacts.elastic.co/downloads/kibana/${name}-${plat}-${arch}.tar.gz";
sha256 = shas."${stdenv.system}" or (throw "Unknown architecture"); sha256 = shas."${stdenv.system}" or (throw "Unknown architecture");
}; };
@ -33,13 +56,20 @@ in stdenv.mkDerivation rec {
makeWrapper $out/libexec/kibana/bin/kibana $out/bin/kibana \ makeWrapper $out/libexec/kibana/bin/kibana $out/bin/kibana \
--prefix PATH : "${stdenv.lib.makeBinPath [ nodejs coreutils which ]}" --prefix PATH : "${stdenv.lib.makeBinPath [ nodejs coreutils which ]}"
sed -i 's@NODE=.*@NODE=${nodejs}/bin/node@' $out/libexec/kibana/bin/kibana sed -i 's@NODE=.*@NODE=${nodejs}/bin/node@' $out/libexec/kibana/bin/kibana
'' +
# 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 = { meta = {
description = "Visualize logs and time-stamped data"; description = "Visualize logs and time-stamped data";
homepage = http://www.elasticsearch.org/overview/kibana; homepage = http://www.elasticsearch.org/overview/kibana;
license = licenses.asl20; license = if enableUnfree then licenses.elastic else licenses.asl20;
maintainers = with maintainers; [ offline rickynils ]; maintainers = with maintainers; [ offline rickynils basvandijk ];
platforms = with platforms; unix; platforms = with platforms; unix;
}; };
} }

View file

@ -3386,12 +3386,13 @@ with pkgs;
keyfuzz = callPackage ../tools/inputmethods/keyfuzz { }; keyfuzz = callPackage ../tools/inputmethods/keyfuzz { };
kibana = callPackage ../development/tools/misc/kibana { };
kibana5 = callPackage ../development/tools/misc/kibana/5.x.nix { }; kibana5 = callPackage ../development/tools/misc/kibana/5.x.nix { };
kibana6 = callPackage ../development/tools/misc/kibana/6.x.nix { }; kibana6 = callPackage ../development/tools/misc/kibana/default.nix { };
kibana6-oss = callPackage ../development/tools/misc/kibana/6.x.nix { kibana6-oss = callPackage ../development/tools/misc/kibana/default.nix {
enableUnfree = false; enableUnfree = false;
}; };
kibana = kibana6;
kibana-oss = kibana6-oss;
kismet = callPackage ../applications/networking/sniffers/kismet { }; kismet = callPackage ../applications/networking/sniffers/kismet { };