nixpkgs/pkgs/servers/mqtt/mosquitto/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

86 lines
1.9 KiB
Nix
Raw Normal View History

2021-01-26 16:56:46 +00:00
{ stdenv
, lib
, fetchFromGitHub
, cmake
, docbook_xsl
, libxslt
, c-ares
, cjson
, libuuid
, libuv
, libwebsockets
2021-01-26 16:56:46 +00:00
, openssl
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
2021-01-26 16:56:46 +00:00
, systemd
, uthash
, nixosTests
2021-01-26 16:56:46 +00:00
}:
let
# Mosquitto needs external poll enabled in libwebsockets.
libwebsockets' = (libwebsockets.override {
withExternalPoll = true;
}).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" ];
});
in
2019-04-24 08:22:57 +00:00
stdenv.mkDerivation rec {
pname = "mosquitto";
version = "2.0.20";
src = fetchFromGitHub {
2021-01-26 16:56:46 +00:00
owner = "eclipse";
repo = "mosquitto";
2021-01-26 16:56:46 +00:00
rev = "v${version}";
hash = "sha256-oZo6J6mxMC05jJ8RXIunOMB3kptA6FElchKlg4qmuQ8=";
};
2017-09-28 19:15:42 +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
'';
outputs = [ "out" "dev" "lib" ];
2021-01-26 16:56:46 +00:00
nativeBuildInputs = [ cmake docbook_xsl libxslt ];
buildInputs = [
2021-01-26 16:56:46 +00:00
c-ares
cjson
libuuid
libuv
libwebsockets'
2021-01-26 16:56:46 +00:00
openssl
uthash
] ++ lib.optional withSystemd systemd;
cmakeFlags = [
(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
'';
passthru.tests = {
inherit (nixosTests) mosquitto;
};
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/";
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";
};
}