45 lines
1.3 KiB
Nix
45 lines
1.3 KiB
Nix
{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomjs2 }:
|
|
|
|
buildGoPackage rec {
|
|
pname = "grafana";
|
|
version = "6.5.3";
|
|
|
|
goPackagePath = "github.com/grafana/grafana";
|
|
|
|
excludedPackages = [ "release_publisher" ];
|
|
|
|
src = fetchFromGitHub {
|
|
rev = "v${version}";
|
|
owner = "grafana";
|
|
repo = "grafana";
|
|
sha256 = "1ks951b3ar1wdpbxn8ak74m8zh02d3lbmk6mphwni68c019ymahi";
|
|
};
|
|
|
|
srcStatic = fetchurl {
|
|
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
|
|
sha256 = "1gjj0h7kz4lan00ka5kg901l3nyzswnjfr0slqy08bl4svqpizh2";
|
|
};
|
|
|
|
postPatch = ''
|
|
substituteInPlace pkg/cmd/grafana-server/main.go \
|
|
--replace 'var version = "5.0.0"' 'var version = "${version}"'
|
|
'';
|
|
|
|
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,tools} $bin/share/grafana/
|
|
ln -sf ${phantomjs2}/bin/phantomjs $bin/share/grafana/tools/phantomjs/phantomjs
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB";
|
|
license = licenses.asl20;
|
|
homepage = "https://grafana.com";
|
|
maintainers = with maintainers; [ offline fpletz willibutz globin ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|