nixpkgs/pkgs/development/tools/misc/kibana/7.x.nix
2021-11-03 11:35:51 +01:00

61 lines
1.7 KiB
Nix

{ elk7Version
, enableUnfree ? true
, lib
, stdenv
, makeWrapper
, fetchurl
, nodejs-14_x
, coreutils
, which
}:
with lib;
let
nodejs = nodejs-14_x;
inherit (builtins) elemAt;
info = splitString "-" stdenv.hostPlatform.system;
arch = elemAt info 0;
plat = elemAt info 1;
shas =
{
x86_64-linux = "19p9s4sir982bb1zcldrbphhwfs9i11p0q28vgc421iqg10kjlf1";
x86_64-darwin = "0qq557ngwwakifidyrccga4cadj9k9pzhjwy4msmbcgf5pb86qyc";
aarch64-linux = "183cp1h8d3n7xfcpcys4hf36palczxa409afyp62kzyzckngy0j8";
};
in stdenv.mkDerivation rec {
pname = "kibana";
version = elk7Version;
src = fetchurl {
url = "https://artifacts.elastic.co/downloads/kibana/${pname}-${version}-${plat}-${arch}.tar.gz";
sha256 = shas.${stdenv.hostPlatform.system} or (throw "Unknown architecture");
};
patches = [
# Kibana specifies it specifically needs nodejs 10.15.2 but nodejs in nixpkgs is at 10.15.3.
# The <nixpkgs/nixos/tests/elk.nix> test succeeds with this newer version so lets just
# disable the version check.
./disable-nodejs-version-check-7.patch
];
nativeBuildInputs = [ 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 : "${lib.makeBinPath [ nodejs coreutils which ]}"
sed -i 's@NODE=.*@NODE=${nodejs}/bin/node@' $out/libexec/kibana/bin/kibana
'';
meta = {
description = "Visualize logs and time-stamped data";
homepage = "http://www.elasticsearch.org/overview/kibana";
license = licenses.elastic;
maintainers = with maintainers; [ offline basvandijk ];
platforms = with platforms; unix;
};
}