2021-04-08 16:26:57 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, docbook_xsl
|
|
|
|
, libxslt
|
|
|
|
, c-ares
|
|
|
|
, cjson
|
|
|
|
, libuuid
|
|
|
|
, libuv
|
2021-12-06 16:07:01 +00:00
|
|
|
, libwebsockets
|
2021-04-08 16:26:57 +00:00
|
|
|
, openssl
|
2023-02-02 18:25:31 +00:00
|
|
|
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
|
2021-04-08 16:26:57 +00:00
|
|
|
, systemd
|
2024-01-02 11:29:13 +00:00
|
|
|
, uthash
|
2023-11-16 04:20:00 +00:00
|
|
|
, nixosTests
|
2021-04-08 16:26:57 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
let
|
|
|
|
# Mosquitto needs external poll enabled in libwebsockets.
|
2023-08-04 22:07:22 +00:00
|
|
|
libwebsockets' = (libwebsockets.override {
|
2021-12-06 16:07:01 +00:00
|
|
|
withExternalPoll = true;
|
2023-08-04 22:07:22 +00:00
|
|
|
}).overrideAttrs (old: {
|
|
|
|
# Avoid bug in firefox preventing websockets being created over http/2 connections
|
|
|
|
# https://github.com/eclipse/mosquitto/issues/1211#issuecomment-958137569
|
|
|
|
cmakeFlags = old.cmakeFlags ++ [ "-DLWS_WITH_HTTP2=OFF" ];
|
|
|
|
});
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "mosquitto";
|
2024-10-23 06:41:50 +00:00
|
|
|
version = "2.0.20";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-04-08 16:26:57 +00:00
|
|
|
owner = "eclipse";
|
2024-10-11 05:15:48 +00:00
|
|
|
repo = "mosquitto";
|
2021-04-08 16:26:57 +00:00
|
|
|
rev = "v${version}";
|
2024-10-23 06:41:50 +00:00
|
|
|
hash = "sha256-oZo6J6mxMC05jJ8RXIunOMB3kptA6FElchKlg4qmuQ8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
for f in html manpage ; do
|
|
|
|
substituteInPlace man/$f.xsl \
|
|
|
|
--replace http://docbook.sourceforge.net/release/xsl/current ${docbook_xsl}/share/xml/docbook-xsl
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
outputs = [ "out" "dev" "lib" ];
|
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
nativeBuildInputs = [ cmake docbook_xsl libxslt ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
2021-04-08 16:26:57 +00:00
|
|
|
c-ares
|
|
|
|
cjson
|
|
|
|
libuuid
|
|
|
|
libuv
|
2021-12-06 16:07:01 +00:00
|
|
|
libwebsockets'
|
2021-04-08 16:26:57 +00:00
|
|
|
openssl
|
2024-01-02 11:29:13 +00:00
|
|
|
uthash
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ lib.optional withSystemd systemd;
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2024-01-02 11:29:13 +00:00
|
|
|
(lib.cmakeBool "WITH_BUNDLED_DEPS" false)
|
|
|
|
(lib.cmakeBool "WITH_WEBSOCKETS" true)
|
|
|
|
(lib.cmakeBool "WITH_SYSTEMD" withSystemd)
|
|
|
|
];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
sed -i "s|^prefix=.*|prefix=$lib|g" $dev/lib/pkgconfig/*.pc
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) mosquitto;
|
|
|
|
};
|
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Open source MQTT v3.1/3.1.1/5.0 broker";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://mosquitto.org/";
|
2024-10-11 05:15:48 +00:00
|
|
|
changelog = "https://github.com/eclipse/mosquitto/blob/v${version}/ChangeLog.txt";
|
|
|
|
license = lib.licenses.epl10;
|
|
|
|
maintainers = [ lib.maintainers.peterhoeg ];
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
mainProgram = "mosquitto";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|