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

42 lines
1.3 KiB
Nix
Raw Normal View History

{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomjs2 }:
2015-11-16 14:28:03 +01:00
2016-06-06 02:28:52 +02:00
buildGoPackage rec {
2018-07-25 17:05:57 +02:00
version = "5.2.2";
2018-02-27 14:07:49 +01:00
name = "grafana-${version}";
2015-11-16 14:28:03 +01:00
goPackagePath = "github.com/grafana/grafana";
src = fetchFromGitHub {
rev = "v${version}";
owner = "grafana";
repo = "grafana";
2018-07-25 17:05:57 +02:00
sha256 = "17w8ljq4p1sxcdpsiz4221gwhi3ykggpisnx1wdw22g2160q9sdj";
2015-11-16 14:28:03 +01:00
};
srcStatic = fetchurl {
url = "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-${version}.linux-amd64.tar.gz";
2018-07-25 17:05:57 +02:00
sha256 = "1frbk13sww3sw09mpkijii1kf7m19hqg58ps8gvs4dvxg12bbv3l";
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 $bin/share/grafana
2018-03-01 17:07:50 +01:00
mv grafana-*/{public,conf,tools} $bin/share/grafana/
ln -sf ${phantomjs2}/bin/phantomjs $bin/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;
2017-09-05 19:01:01 +02:00
homepage = https://grafana.org/;
maintainers = with maintainers; [ offline fpletz willibutz ];
platforms = platforms.linux;
2015-11-16 14:28:03 +01:00
};
}