depot/third_party/nixpkgs/pkgs/servers/monitoring/grafana/default.nix
Default email ae1b531433 Project import generated by Copybara.
GitOrigin-RevId: 1dc37370c489b610f8b91d7fdd40633163ffbafd
2020-10-27 01:29:36 +01:00

49 lines
1.4 KiB
Nix

{ lib, buildGoModule, fetchurl, fetchFromGitHub, nixosTests }:
buildGoModule rec {
pname = "grafana";
version = "7.2.2";
excludedPackages = [ "release_publisher" ];
src = fetchFromGitHub {
rev = "v${version}";
owner = "grafana";
repo = "grafana";
sha256 = "14i1h0v6bwb3y1xqs71dabriyd7gdgihb8wkf3gpjr4gnsywvsgm";
};
srcStatic = fetchurl {
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
sha256 = "03jf5wnf89a3fawdayl5x5rfyc3dsf9wm5dm1ldz9fqk31biq8ky";
};
vendorSha256 = "03zvhznzdbi61kd0y0ldhx2n9zh3pwg1ias1shqgqyx46c9ysdzm";
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
'';
postInstall = ''
tar -xvf $srcStatic
mkdir -p $out/share/grafana
mv grafana-*/{public,conf,tools} $out/share/grafana/
'';
passthru.tests = { inherit (nixosTests) grafana; };
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 ma27 Frostman ];
platforms = platforms.linux;
};
}