2021-01-26 16:56:46 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, docbook_xsl
|
|
|
|
, libxslt
|
|
|
|
, c-ares
|
|
|
|
, cjson
|
|
|
|
, libuuid
|
|
|
|
, libuv
|
2021-11-23 18:15:33 +00:00
|
|
|
, libwebsockets
|
2021-01-26 16:56:46 +00:00
|
|
|
, openssl
|
2022-09-21 07:04:52 +00:00
|
|
|
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
|
2021-01-26 16:56:46 +00:00
|
|
|
, systemd
|
2023-12-11 22:04:18 +00:00
|
|
|
, uthash
|
2023-10-21 23:11:35 +00:00
|
|
|
, nixosTests
|
2021-01-26 16:56:46 +00:00
|
|
|
}:
|
2015-02-19 22:53:44 +00:00
|
|
|
|
2021-11-23 18:15:33 +00:00
|
|
|
let
|
|
|
|
# Mosquitto needs external poll enabled in libwebsockets.
|
2023-07-21 01:54:07 +00:00
|
|
|
libwebsockets' = (libwebsockets.override {
|
2021-11-23 18:15:33 +00:00
|
|
|
withExternalPoll = true;
|
2023-07-21 01:54:07 +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-11-23 18:15:33 +00:00
|
|
|
in
|
2019-04-24 08:22:57 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "mosquitto";
|
2024-10-17 08:14:04 +00:00
|
|
|
version = "2.0.20";
|
2015-02-19 22:53:44 +00:00
|
|
|
|
2018-10-11 09:03:32 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-01-26 16:56:46 +00:00
|
|
|
owner = "eclipse";
|
2024-10-17 09:34:57 +00:00
|
|
|
repo = "mosquitto";
|
2021-01-26 16:56:46 +00:00
|
|
|
rev = "v${version}";
|
2024-10-17 08:14:04 +00:00
|
|
|
hash = "sha256-oZo6J6mxMC05jJ8RXIunOMB3kptA6FElchKlg4qmuQ8=";
|
2015-02-19 22:53:44 +00:00
|
|
|
};
|
|
|
|
|
2017-09-28 19:15:42 +00:00
|
|
|
postPatch = ''
|
2019-03-01 10:53:45 +00:00
|
|
|
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
|
2015-02-19 22:53:44 +00:00
|
|
|
'';
|
|
|
|
|
2023-04-25 12:52:09 +00:00
|
|
|
outputs = [ "out" "dev" "lib" ];
|
|
|
|
|
2021-01-26 16:56:46 +00:00
|
|
|
nativeBuildInputs = [ cmake docbook_xsl libxslt ];
|
|
|
|
|
2019-03-01 10:53:45 +00:00
|
|
|
buildInputs = [
|
2021-01-26 16:56:46 +00:00
|
|
|
c-ares
|
|
|
|
cjson
|
|
|
|
libuuid
|
|
|
|
libuv
|
2021-11-23 18:15:33 +00:00
|
|
|
libwebsockets'
|
2021-01-26 16:56:46 +00:00
|
|
|
openssl
|
2023-12-11 22:04:18 +00:00
|
|
|
uthash
|
2019-03-01 10:53:45 +00:00
|
|
|
] ++ lib.optional withSystemd systemd;
|
2018-10-11 09:03:32 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2023-12-11 22:04:18 +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
|
|
|
|
'';
|
2018-10-11 09:03:32 +00:00
|
|
|
|
2023-10-21 23:11:35 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) mosquitto;
|
|
|
|
};
|
|
|
|
|
2024-10-17 09:25:43 +00:00
|
|
|
meta = {
|
2021-01-26 16:56:46 +00:00
|
|
|
description = "Open source MQTT v3.1/3.1.1/5.0 broker";
|
2019-09-16 04:28:46 +00:00
|
|
|
homepage = "https://mosquitto.org/";
|
2024-10-17 08:57:56 +00:00
|
|
|
changelog = "https://github.com/eclipse/mosquitto/blob/v${version}/ChangeLog.txt";
|
2024-10-17 09:25:43 +00:00
|
|
|
license = lib.licenses.epl10;
|
|
|
|
maintainers = [ lib.maintainers.peterhoeg ];
|
|
|
|
platforms = lib.platforms.unix;
|
2024-10-17 09:39:33 +00:00
|
|
|
mainProgram = "mosquitto";
|
2015-02-19 22:53:44 +00:00
|
|
|
};
|
|
|
|
}
|