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

45 lines
1.3 KiB
Nix
Raw Normal View History

{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomjs2 }:
2015-11-16 16:28:03 +03:00
2016-06-06 03:28:52 +03:00
buildGoPackage rec {
pname = "grafana";
2019-12-11 19:00:59 +03:00
version = "6.5.2";
2019-08-31 10:50:38 +03:00
2015-11-16 16:28:03 +03:00
goPackagePath = "github.com/grafana/grafana";
2019-02-26 22:30:02 +03:00
excludedPackages = [ "release_publisher" ];
2015-11-16 16:28:03 +03:00
src = fetchFromGitHub {
rev = "v${version}";
owner = "grafana";
repo = "grafana";
2019-12-11 19:00:59 +03:00
sha256 = "1hplnb8rv2sxai05qf6il5kza08bkhcawvymr2h9lfdsj7p4kbzy";
2015-11-16 16:28:03 +03:00
};
srcStatic = fetchurl {
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
2019-12-11 19:00:59 +03:00
sha256 = "1fnj41lp9b53iyjgis5x8k3g5vl73fdrxsdxnf10d4ma95cwb2qa";
2015-11-16 16:28:03 +03:00
};
postPatch = ''
substituteInPlace pkg/cmd/grafana-server/main.go \
--replace 'var version = "5.0.0"' 'var version = "${version}"'
'';
2015-11-16 16:28:03 +03:00
preBuild = "export GOPATH=$GOPATH:$NIX_BUILD_TOP/go/src/${goPackagePath}/Godeps/_workspace";
2015-11-16 16:28:03 +03:00
postInstall = ''
tar -xvf $srcStatic
mkdir -p $bin/share/grafana
2018-03-01 19:07:50 +03:00
mv grafana-*/{public,conf,tools} $bin/share/grafana/
ln -sf ${phantomjs2}/bin/phantomjs $bin/share/grafana/tools/phantomjs/phantomjs
2015-11-16 16:28:03 +03:00
'';
meta = with lib; {
description = "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB";
license = licenses.asl20;
2019-08-15 15:30:23 +03:00
homepage = "https://grafana.com";
maintainers = with maintainers; [ offline fpletz willibutz globin ];
platforms = platforms.linux;
2015-11-16 16:28:03 +03:00
};
}