From fae6a45e9223c789a9ce9f3ac1ceff315523fc50 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Thu, 12 May 2022 07:50:00 +0200 Subject: [PATCH] darkstat: Fix build on darwin On recent macOS the build fails with: ``` now.c:33:16: error: typedef redefinition with different types ('int' vs 'enum clockid_t') typedef int clockid_t; ^ /nix/store/4df4jhlj71vblmxhrr7dkkqpak8a42c8-Libsystem-1238.60.2/include/time.h:171:3: note: previous definition is here } clockid_t; ^ now.c:34:11: warning: 'CLOCK_REALTIME' macro redefined [-Wmacro-redefined] ^ /nix/store/4df4jhlj71vblmxhrr7dkkqpak8a42c8-Libsystem-1238.60.2/include/time.h:154:9: note: previous definition is here ^ now.c:35:11: warning: 'CLOCK_MONOTONIC' macro redefined [-Wmacro-redefined] ^ /nix/store/4df4jhlj71vblmxhrr7dkkqpak8a42c8-Libsystem-1238.60.2/include/time.h:156:9: note: previous definition is here ^ 2 warnings and 1 error generated. ``` --- pkgs/tools/networking/darkstat/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/networking/darkstat/default.nix b/pkgs/tools/networking/darkstat/default.nix index 04cab365578..2da581776d2 100644 --- a/pkgs/tools/networking/darkstat/default.nix +++ b/pkgs/tools/networking/darkstat/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, libpcap, zlib }: +{ lib, stdenv, fetchpatch, fetchurl, libpcap, zlib }: stdenv.mkDerivation rec { version = "3.0.719"; @@ -9,6 +9,15 @@ stdenv.mkDerivation rec { sha256 = "1mzddlim6dhd7jhr4smh0n2fa511nvyjhlx76b03vx7phnar1bxf"; }; + patches = [ + # Avoid multiple definitions of CLOCK_REALTIME on macOS 11, + # see https://github.com/emikulic/darkstat/pull/2 + (fetchpatch { + url = "https://github.com/emikulic/darkstat/commit/d2fd232e1167dee6e7a2d88b9ab7acf2a129f697.diff"; + sha256 = "0z5mpyc0q65qb6cn4xcrxl0vx21d8ibzaam5kjyrcw4icd8yg4jb"; + }) + ]; + buildInputs = [ libpcap zlib ]; enableParallelBuilding = true;