nixpkgs/pkgs/servers/monitoring/grafana/default.nix
2017-02-15 00:40:53 +01:00

37 lines
1.2 KiB
Nix

{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomjs2 }:
buildGoPackage rec {
version = "4.1.2";
ts = "1486989747";
name = "grafana-v${version}";
goPackagePath = "github.com/grafana/grafana";
src = fetchFromGitHub {
rev = "v${version}";
owner = "grafana";
repo = "grafana";
sha256 = "0x2knb2lrs6sbj3svcjn70p46fzdy71gh8fgi801g1l0yp9s5yrg";
};
srcStatic = fetchurl {
url = "https://grafanarel.s3.amazonaws.com/builds/grafana-${version}-${ts}.linux-x64.tar.gz";
sha256 = "1i7n1a2xn65flwy2zqs3kqg1ch51653r52qn3gfh5hp92k81q4dq";
};
preBuild = "export GOPATH=$GOPATH:$NIX_BUILD_TOP/go/src/${goPackagePath}/Godeps/_workspace";
postInstall = ''
tar -xvf $srcStatic
mkdir -p $bin/share/grafana
mv grafana-*/{public,conf,vendor} $bin/share/grafana/
ln -sf ${phantomjs2}/bin/phantomjs $bin/share/grafana/vendor/phantomjs/phantomjs
'';
meta = with lib; {
description = "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB";
license = licenses.asl20;
homepage = http://grafana.org/;
maintainers = with maintainers; [ offline fpletz ];
platforms = platforms.linux;
};
}