From a7bf9ea8b5e773d9b4f49a7c28d63f636f07e181 Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Sat, 4 Sep 2021 12:26:20 -0400 Subject: [PATCH] grafana: support darwin --- pkgs/servers/monitoring/grafana/default.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/monitoring/grafana/default.nix b/pkgs/servers/monitoring/grafana/default.nix index 996637f51b9e..c252747c2fcf 100644 --- a/pkgs/servers/monitoring/grafana/default.nix +++ b/pkgs/servers/monitoring/grafana/default.nix @@ -1,4 +1,4 @@ -{ lib, buildGoModule, fetchurl, fetchFromGitHub, nixosTests }: +{ lib, buildGoModule, fetchurl, fetchFromGitHub, nixosTests, tzdata }: buildGoModule rec { pname = "grafana"; @@ -47,6 +47,16 @@ buildGoModule rec { "-s" "-w" "-X main.version=${version}" ]; + # 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 + ''; + postInstall = '' tar -xvf $srcStatic mkdir -p $out/share/grafana @@ -60,6 +70,6 @@ buildGoModule rec { license = licenses.agpl3; homepage = "https://grafana.com"; maintainers = with maintainers; [ offline fpletz willibutz globin ma27 Frostman ]; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.darwin; }; }