From 065992e4f88361938844e37decbe471228566bae Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Tue, 23 Nov 2021 19:15:33 +0100 Subject: [PATCH] mosquitto: use libwebsockets 4.x This requires us to enable LWS_WITH_EXTERNAL_POLL. Since only mosquitto needs that and upstream discourages enabling it, we'll just do it in an override in mosquitto. --- pkgs/development/libraries/libwebsockets/default.nix | 5 ++++- pkgs/servers/mqtt/mosquitto/default.nix | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/libwebsockets/default.nix b/pkgs/development/libraries/libwebsockets/default.nix index 15bf77d2fc68..faf6acd40b92 100644 --- a/pkgs/development/libraries/libwebsockets/default.nix +++ b/pkgs/development/libraries/libwebsockets/default.nix @@ -5,6 +5,8 @@ , openssl , zlib , libuv +# External poll is required for e.g. mosquitto, but discouraged by the maintainer. +, withExternalPoll ? false }: let @@ -29,7 +31,8 @@ let "-DLWS_WITH_SOCKS5=ON" # Required since v4.2.0 "-DLWS_BUILD_HASH=no_hash" - ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DLWS_WITHOUT_TESTAPPS=ON"; + ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DLWS_WITHOUT_TESTAPPS=ON" + ++ lib.optional withExternalPoll "-DLWS_WITH_EXTERNAL_POLL=ON"; NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=unused-but-set-variable"; diff --git a/pkgs/servers/mqtt/mosquitto/default.nix b/pkgs/servers/mqtt/mosquitto/default.nix index 67200f5515a9..81821f1b7c49 100644 --- a/pkgs/servers/mqtt/mosquitto/default.nix +++ b/pkgs/servers/mqtt/mosquitto/default.nix @@ -8,13 +8,19 @@ , cjson , libuuid , libuv -, libwebsockets_3_1 +, libwebsockets , openssl , withSystemd ? stdenv.isLinux , systemd , fetchpatch }: +let + # Mosquitto needs external poll enabled in libwebsockets. + libwebsockets' = libwebsockets.override { + withExternalPoll = true; + }; +in stdenv.mkDerivation rec { pname = "mosquitto"; version = "2.0.12"; @@ -54,7 +60,7 @@ stdenv.mkDerivation rec { cjson libuuid libuv - libwebsockets_3_1 + libwebsockets' openssl ] ++ lib.optional withSystemd systemd;