From 212ef28fc0e0b56a7f9cbef96722efa1e590987a Mon Sep 17 00:00:00 2001 From: Jon Hermansen Date: Fri, 31 Oct 2025 17:43:37 -0400 Subject: [PATCH] ngtcp2: avoid building examples on FreeBSD due to Linux-specific socket APIs The ngtcp2 examples use Linux-specific socket options (IP_PKTINFO, IPTOS_ECN_MASK, IP_RECVTOS) for packet metadata and ECN support that are not available on FreeBSD. Enable ENABLE_LIB_ONLY on FreeBSD to skip examples while building the core library. --- pkgs/development/libraries/ngtcp2/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/ngtcp2/default.nix b/pkgs/development/libraries/ngtcp2/default.nix index 1f88deb6363f..49a2f417a0d5 100644 --- a/pkgs/development/libraries/ngtcp2/default.nix +++ b/pkgs/development/libraries/ngtcp2/default.nix @@ -39,7 +39,8 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ # The examples try to link against `ngtcp2_crypto_ossl` and `ngtcp2` libraries. # This works in the dynamic case where the targets have the same name, but not here where they're suffixed with `_static`. - (lib.cmakeBool "ENABLE_LIB_ONLY" stdenv.hostPlatform.isStatic) + # Also, the examples depend on Linux-specific APIs, so we avoid them on FreeBSD too. + (lib.cmakeBool "ENABLE_LIB_ONLY" (stdenv.hostPlatform.isStatic || stdenv.hostPlatform.isFreeBSD)) (lib.cmakeBool "ENABLE_SHARED_LIB" (!stdenv.hostPlatform.isStatic)) (lib.cmakeBool "ENABLE_STATIC_LIB" stdenv.hostPlatform.isStatic) ];