2020-08-20 17:08:02 +00:00
|
|
|
{ lib, buildGoModule, fetchurl, fetchFromGitHub, nixosTests }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "grafana";
|
2021-05-28 09:39:13 +00:00
|
|
|
version = "7.5.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
excludedPackages = [ "release_publisher" ];
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
rev = "v${version}";
|
|
|
|
owner = "grafana";
|
|
|
|
repo = "grafana";
|
2021-05-28 09:39:13 +00:00
|
|
|
sha256 = "sha256-GTQK02zxOBTE+93vT0zLMhAeZ7F3Cq/0lbvbzwB2QZA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
srcStatic = fetchurl {
|
|
|
|
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
|
2021-05-28 09:39:13 +00:00
|
|
|
sha256 = "sha256-IQ7aAuUrNa+bSh5ld6IttujM8AgKUSlu8H7pwzDi164=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
vendorSha256 = "sha256-AsPRaRLomp090XAKLXLXKm40ESPO4im9qi6VLpLYRQU=";
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# grafana-aws-sdk is specified with two versions which causes a problem later:
|
|
|
|
# go: inconsistent vendoring in /build/source:
|
|
|
|
# github.com/grafana/grafana-aws-sdk@v0.3.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
|
|
|
|
# Remove the older one here to fix this.
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
substituteInPlace go.mod \
|
|
|
|
--replace 'github.com/grafana/grafana-aws-sdk v0.3.0' ""
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace pkg/cmd/grafana-server/main.go \
|
|
|
|
--replace 'var version = "5.0.0"' 'var version = "${version}"'
|
|
|
|
'';
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
# main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/scripts/go
|
2021-02-05 17:12:51 +00:00
|
|
|
# main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/dashboard-schemas
|
2020-10-07 09:15:18 +00:00
|
|
|
preBuild = ''
|
2021-02-05 17:12:51 +00:00
|
|
|
rm -r dashboard-schemas scripts/go
|
2020-10-07 09:15:18 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
tar -xvf $srcStatic
|
2020-05-15 21:57:56 +00:00
|
|
|
mkdir -p $out/share/grafana
|
|
|
|
mv grafana-*/{public,conf,tools} $out/share/grafana/
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) grafana; };
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|