nixos/fileSystems: link to mount(8) from fileSystems.*.options (#377170)
[NixPkgs.git] / pkgs / by-name / mo / mosquitto / package.nix
blob4792b23d15718fa01f1ed8ceb78344f540177ce3
2   stdenv,
3   lib,
4   fetchFromGitHub,
5   cmake,
6   docbook_xsl,
7   libxslt,
8   c-ares,
9   cjson,
10   libuuid,
11   libuv,
12   libwebsockets,
13   openssl,
14   withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
15   systemd,
16   uthash,
17   nixosTests,
20 let
21   # Mosquitto needs external poll enabled in libwebsockets.
22   libwebsockets' =
23     (libwebsockets.override {
24       withExternalPoll = true;
25     }).overrideAttrs
26       (old: {
27         # Avoid bug in firefox preventing websockets being created over http/2 connections
28         # https://github.com/eclipse/mosquitto/issues/1211#issuecomment-958137569
29         cmakeFlags = old.cmakeFlags ++ [ "-DLWS_WITH_HTTP2=OFF" ];
30       });
33 stdenv.mkDerivation rec {
34   pname = "mosquitto";
35   version = "2.0.20";
37   src = fetchFromGitHub {
38     owner = "eclipse";
39     repo = "mosquitto";
40     rev = "v${version}";
41     hash = "sha256-oZo6J6mxMC05jJ8RXIunOMB3kptA6FElchKlg4qmuQ8=";
42   };
44   postPatch = ''
45     for f in html manpage ; do
46       substituteInPlace man/$f.xsl \
47         --replace http://docbook.sourceforge.net/release/xsl/current ${docbook_xsl}/share/xml/docbook-xsl
48     done
49   '';
51   outputs = [
52     "out"
53     "dev"
54     "lib"
55   ];
57   nativeBuildInputs = [
58     cmake
59     docbook_xsl
60     libxslt
61   ];
63   buildInputs = [
64     c-ares
65     cjson
66     libuuid
67     libuv
68     libwebsockets'
69     openssl
70     uthash
71   ] ++ lib.optional withSystemd systemd;
73   cmakeFlags = [
74     (lib.cmakeBool "WITH_BUNDLED_DEPS" false)
75     (lib.cmakeBool "WITH_WEBSOCKETS" true)
76     (lib.cmakeBool "WITH_SYSTEMD" withSystemd)
77   ];
79   postFixup = ''
80     sed -i "s|^prefix=.*|prefix=$lib|g" $dev/lib/pkgconfig/*.pc
81   '';
83   passthru.tests = {
84     inherit (nixosTests) mosquitto;
85   };
87   meta = {
88     description = "Open source MQTT v3.1/3.1.1/5.0 broker";
89     homepage = "https://mosquitto.org/";
90     changelog = "https://github.com/eclipse/mosquitto/blob/v${version}/ChangeLog.txt";
91     license = lib.licenses.epl10;
92     maintainers = [ lib.maintainers.peterhoeg ];
93     platforms = lib.platforms.unix;
94     mainProgram = "mosquitto";
95   };