42 lines
1.3 KiB
Nix
42 lines
1.3 KiB
Nix
{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomjs2 }:
|
|
|
|
buildGoPackage rec {
|
|
version = "5.2.4";
|
|
name = "grafana-${version}";
|
|
goPackagePath = "github.com/grafana/grafana";
|
|
|
|
src = fetchFromGitHub {
|
|
rev = "v${version}";
|
|
owner = "grafana";
|
|
repo = "grafana";
|
|
sha256 = "15w935i22ddx6ff32ynypjh3q670vnrj74qw0vdkxdmrlwk3q7wc";
|
|
};
|
|
|
|
srcStatic = fetchurl {
|
|
url = "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-${version}.linux-amd64.tar.gz";
|
|
sha256 = "187dqjahz1z1gkcx9pxnf2hri6g3b5j3ppadwfahz0rwsqj4v2lf";
|
|
};
|
|
|
|
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.org/;
|
|
maintainers = with maintainers; [ offline fpletz willibutz ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|