2022-02-04 13:16:47 +01:00
|
|
|
{ lib, buildGoModule, fetchurl, fetchFromGitHub, nixosTests, tzdata, wire }:
|
2015-11-16 14:28:03 +01:00
|
|
|
|
2022-02-04 13:16:47 +01:00
|
|
|
buildGoModule rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "grafana";
|
2022-04-28 15:50:23 +02:00
|
|
|
version = "8.5.1";
|
2015-11-16 14:28:03 +01:00
|
|
|
|
2022-02-26 16:01:37 +01:00
|
|
|
excludedPackages = [ "alert_webhook_listener" "clean-swagger" "release_publisher" "slow_proxy" "slow_proxy_mac" "macaron" ];
|
2019-02-26 20:30:02 +01:00
|
|
|
|
2015-11-16 14:28:03 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
rev = "v${version}";
|
|
|
|
owner = "grafana";
|
|
|
|
repo = "grafana";
|
2022-04-28 15:50:23 +02:00
|
|
|
sha256 = "sha256-GwvJA+lcbUuVbzniDW6gYbxQO5uXSP6rjzgmcJ5YYxk=";
|
2015-11-16 14:28:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
srcStatic = fetchurl {
|
2019-08-29 17:16:47 +02:00
|
|
|
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
|
2022-04-28 15:50:23 +02:00
|
|
|
sha256 = "030zl5k8b4hcay06a2lvlmq8swbix88ii4gz9yd4kywcjy5vhnyf";
|
2015-11-16 14:28:03 +01:00
|
|
|
};
|
|
|
|
|
2022-04-28 15:50:23 +02:00
|
|
|
vendorSha256 = "sha256-ZL+A6Sz0uHg7ZzYHmA4EU5ZxfRXBLyKglk135iQT600=";
|
2021-11-04 09:34:43 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ wire ];
|
2021-06-15 12:16:55 +02:00
|
|
|
|
2020-09-27 00:34:59 +02:00
|
|
|
preBuild = ''
|
2021-11-04 09:34:43 +01:00
|
|
|
# Generate DI code that's required to compile the package.
|
|
|
|
# From https://github.com/grafana/grafana/blob/v8.2.3/Makefile#L33-L35
|
|
|
|
wire gen -tags oss ./pkg/server
|
2021-12-02 17:24:19 +01:00
|
|
|
wire gen -tags oss ./pkg/cmd/grafana-cli/runner
|
2021-11-04 09:34:43 +01:00
|
|
|
|
2021-06-09 00:39:56 +02:00
|
|
|
# The testcase makes an API call against grafana.com:
|
|
|
|
#
|
2021-12-02 17:24:19 +01:00
|
|
|
# [...]
|
|
|
|
# grafana> t=2021-12-02T14:24:58+0000 lvl=dbug msg="Failed to get latest.json repo from github.com" logger=update.checker error="Get \"https://raw.githubusercontent.com/grafana/grafana/main/latest.json\": dial tcp: lookup raw.githubusercontent.com on [::1]:53: read udp [::1]:36391->[::1]:53: read: connection refused"
|
|
|
|
# grafana> t=2021-12-02T14:24:58+0000 lvl=dbug msg="Failed to get plugins repo from grafana.com" logger=plugin.manager error="Get \"https://grafana.com/api/plugins/versioncheck?slugIn=&grafanaVersion=\": dial tcp: lookup grafana.com on [::1]:53: read udp [::1]:41796->[::1]:53: read: connection refused"
|
|
|
|
sed -i -e '/Request is not forbidden if from an admin/a t.Skip();' pkg/tests/api/plugins/api_plugins_test.go
|
2021-06-15 22:32:40 +02:00
|
|
|
|
|
|
|
# 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-06-09 00:39:56 +02:00
|
|
|
|
|
|
|
# main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/scripts/go
|
|
|
|
rm -r scripts/go
|
2020-09-27 00:34:59 +02:00
|
|
|
'';
|
|
|
|
|
2021-08-26 08:45:51 +02:00
|
|
|
ldflags = [
|
|
|
|
"-s" "-w" "-X main.version=${version}"
|
|
|
|
];
|
2021-06-11 11:34:42 +02:00
|
|
|
|
2021-09-04 18:26:20 +02: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
|
|
|
|
'';
|
|
|
|
|
2015-11-16 14:28:03 +01:00
|
|
|
postInstall = ''
|
|
|
|
tar -xvf $srcStatic
|
2020-04-28 03:50:57 +02:00
|
|
|
mkdir -p $out/share/grafana
|
|
|
|
mv grafana-*/{public,conf,tools} $out/share/grafana/
|
2021-12-19 15:44:17 +01:00
|
|
|
|
|
|
|
cp ./conf/defaults.ini $out/share/grafana/conf/
|
2015-11-16 14:28:03 +01:00
|
|
|
'';
|
|
|
|
|
2022-04-14 10:58:50 +02:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) grafana; };
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
};
|
2020-08-20 10:00:54 +02:00
|
|
|
|
2015-11-16 14:28:03 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB";
|
2021-06-09 22:41:53 +02:00
|
|
|
license = licenses.agpl3;
|
2019-08-15 14:30:23 +02:00
|
|
|
homepage = "https://grafana.com";
|
2020-03-21 20:23:26 +01:00
|
|
|
maintainers = with maintainers; [ offline fpletz willibutz globin ma27 Frostman ];
|
2021-09-04 18:26:20 +02:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2021-09-05 22:41:57 +02:00
|
|
|
mainProgram = "grafana-server";
|
2015-11-16 14:28:03 +01:00
|
|
|
};
|
|
|
|
}
|