nixpkgs/pkgs/servers/monitoring/grafana/default.nix

46 lines
1.4 KiB
Nix
Raw Normal View History

{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomJsSupport ? false, phantomjs2 ? null }:
2015-11-16 14:28:03 +01:00
2016-06-06 02:28:52 +02:00
buildGoPackage rec {
pname = "grafana";
2020-04-23 18:38:50 +02:00
version = "6.7.3";
2019-08-31 09:50:38 +02:00
2015-11-16 14:28:03 +01:00
goPackagePath = "github.com/grafana/grafana";
2019-02-26 20:30:02 +01:00
excludedPackages = [ "release_publisher" ];
2015-11-16 14:28:03 +01:00
src = fetchFromGitHub {
rev = "v${version}";
owner = "grafana";
repo = "grafana";
2020-04-23 18:38:50 +02:00
sha256 = "14yrfrn59r3mxbkhs7mg7nlhnvvrmq959r8w4aj6m7wgr32jj8wl";
2015-11-16 14:28:03 +01:00
};
srcStatic = fetchurl {
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
2020-04-23 18:38:50 +02:00
sha256 = "17h70h6cz1bdhczjqa68kxzfm4vi95zdnqzah8hcjr7rwnx874kr";
2015-11-16 14:28:03 +01:00
};
postPatch = ''
substituteInPlace pkg/cmd/grafana-server/main.go \
--replace 'var version = "5.0.0"' 'var version = "${version}"'
'';
2015-11-16 14:28:03 +01:00
preBuild = "export GOPATH=$GOPATH:$NIX_BUILD_TOP/go/src/${goPackagePath}/Godeps/_workspace";
2015-11-16 14:28:03 +01:00
postInstall = ''
tar -xvf $srcStatic
mkdir -p $out/share/grafana
mv grafana-*/{public,conf,tools} $out/share/grafana/
'' + lib.optionalString phantomJsSupport ''
ln -sf ${phantomjs2}/bin/phantomjs $out/share/grafana/tools/phantomjs/phantomjs
2015-11-16 14:28:03 +01:00
'';
meta = with lib; {
description = "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB";
license = licenses.asl20;
2019-08-15 14:30:23 +02:00
homepage = "https://grafana.com";
2020-03-21 20:23:26 +01:00
maintainers = with maintainers; [ offline fpletz willibutz globin ma27 Frostman ];
platforms = platforms.linux;
2015-11-16 14:28:03 +01:00
};
}