2021-09-18 10:52:07 +00:00
|
|
|
{ lib, buildGoModule, fetchurl, fetchFromGitHub, nixosTests, tzdata }:
|
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-10-06 13:57:05 +00:00
|
|
|
version = "8.1.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
excludedPackages = "\\(alert_webhook_listener\\|clean-swagger\\|release_publisher\\|slow_proxy\\|slow_proxy_mac\\|macaron\\)";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
rev = "v${version}";
|
|
|
|
owner = "grafana";
|
|
|
|
repo = "grafana";
|
2021-10-06 13:57:05 +00:00
|
|
|
sha256 = "sha256-PUVRFa3b+O2lY6q3vO+rLUcC+fx80iB78tt60f6Vugk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
srcStatic = fetchurl {
|
|
|
|
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
|
2021-10-06 13:57:05 +00:00
|
|
|
sha256 = "sha256-So9xzet9kPkjcDwNts3iXlCd+u2uiXTo0LVcLc8toyk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
vendorSha256 = "sha256-dn4sliRp58oZALZ8Iu7kE83ntkcMIU84Xr5WoeXlhCI=";
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
preBuild = ''
|
|
|
|
# The testcase makes an API call against grafana.com:
|
|
|
|
#
|
|
|
|
# --- Expected
|
|
|
|
# +++ Actual
|
|
|
|
# @@ -1,4 +1,4 @@
|
|
|
|
# (map[string]interface {}) (len=2) {
|
|
|
|
# - (string) (len=5) "error": (string) (len=16) "plugin not found",
|
|
|
|
# - (string) (len=7) "message": (string) (len=16) "Plugin not found"
|
|
|
|
# + (string) (len=5) "error": (string) (len=171) "Failed to send request: Get \"https://grafana.com/api/plugins/repo/test\": dial tcp: lookup grafana.com on [::1]:53: read udp [::1]:48019->[::1]:53: read: connection refused",
|
|
|
|
# + (string) (len=7) "message": (string) (len=24) "Failed to install plugin"
|
|
|
|
# }
|
|
|
|
sed -i -e '/func TestPluginInstallAccess/a t.Skip();' pkg/tests/api/plugins/api_install_test.go
|
|
|
|
|
|
|
|
# Skip a flaky test (https://github.com/NixOS/nixpkgs/pull/126928#issuecomment-861424128)
|
|
|
|
sed -i -e '/it should change folder successfully and return correct result/{N;s/$/\nt.Skip();/}'\
|
|
|
|
pkg/services/libraryelements/libraryelements_patch_test.go
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
# main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/scripts/go
|
|
|
|
rm -r scripts/go
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s" "-w" "-X main.version=${version}"
|
|
|
|
];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# Tests start http servers which need to bind to local addresses:
|
|
|
|
# panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: bind: operation not permitted
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
|
|
# On Darwin, files under /usr/share/zoneinfo exist, but fail to open in sandbox:
|
|
|
|
# TestValueAsTimezone: date_formats_test.go:33: Invalid has err for input "Europe/Amsterdam": operation not permitted
|
|
|
|
preCheck = ''
|
|
|
|
export ZONEINFO=${tzdata}/share/zoneinfo
|
|
|
|
'';
|
|
|
|
|
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";
|
2021-06-28 23:13:55 +00:00
|
|
|
license = licenses.agpl3;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://grafana.com";
|
|
|
|
maintainers = with maintainers; [ offline fpletz willibutz globin ma27 Frostman ];
|
2021-09-18 10:52:07 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
mainProgram = "grafana-server";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|