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

50 lines
1.4 KiB
Nix
Raw Normal View History

{ lib, buildGoModule, fetchurl, fetchFromGitHub, nixosTests }:
2015-11-16 13:28:03 +00:00
buildGoModule rec {
pname = "grafana";
2020-12-29 21:35:02 +00:00
version = "7.3.6";
2015-11-16 13:28:03 +00:00
2019-02-26 19:30:02 +00:00
excludedPackages = [ "release_publisher" ];
2015-11-16 13:28:03 +00:00
src = fetchFromGitHub {
rev = "v${version}";
owner = "grafana";
repo = "grafana";
2020-12-29 21:35:02 +00:00
sha256 = "10hm5bz2q9mccrjx1x77xckqvn2x9m7cl2dn60gvrl8m7q3afscp";
2015-11-16 13:28:03 +00:00
};
srcStatic = fetchurl {
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
2020-12-29 21:35:02 +00:00
sha256 = "1fl4ng39qkc01nv49cfzm19sv3yzzshl22ylkwlsb41rmaifbd1f";
2015-11-16 13:28:03 +00:00
};
2020-12-29 21:35:02 +00:00
vendorSha256 = "0p4wwacvka5lgzwhlwnn6iiwi9x67zgqf0l4vblpfckvvb3ar41h";
postPatch = ''
substituteInPlace pkg/cmd/grafana-server/main.go \
--replace 'var version = "5.0.0"' 'var version = "${version}"'
'';
# fixes build failure with go 1.15:
# main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/scripts/go
preBuild = ''
rm -rf scripts/go
'';
2015-11-16 13:28:03 +00:00
postInstall = ''
tar -xvf $srcStatic
mkdir -p $out/share/grafana
mv grafana-*/{public,conf,tools} $out/share/grafana/
2015-11-16 13:28:03 +00:00
'';
passthru.tests = { inherit (nixosTests) grafana; };
2015-11-16 13:28:03 +00:00
meta = with lib; {
description = "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB";
license = licenses.asl20;
2019-08-15 13:30:23 +01:00
homepage = "https://grafana.com";
2020-03-21 19:23:26 +00:00
maintainers = with maintainers; [ offline fpletz willibutz globin ma27 Frostman ];
platforms = platforms.linux;
2015-11-16 13:28:03 +00:00
};
}