Mosquitto
Mosquitto provides a lightweight local MQTT broker for development and testing.
Enable it with:
By default, the broker listens on 127.0.0.1 and uses port 1883 through devenv's dynamic port allocation. The resolved port is exposed as MOSQUITTO_PORT, and the configured host is exposed as MOSQUITTO_HOST.
You can customize the listener or append native Mosquitto configuration:
{ ... }:
{
services.mosquitto = {
enable = true;
bind = "127.0.0.1";
port = 1883;
extraConfig = ''
max_queued_messages 1000
'';
};
}
extraConfig is appended to the generated mosquitto.conf.
Options
services.mosquitto.enable
Whether to enable mosquitto MQTT broker.
Type: boolean
Default:
Example:
Declared by: - https://github.com/cachix/devenv/blob/main/src/modules/services/mosquitto.nix
services.mosquitto.package
Which package of mosquitto to use
Type: package
Default:
Declared by: - https://github.com/cachix/devenv/blob/main/src/modules/services/mosquitto.nix
services.mosquitto.bind
The IP interface to bind to.
null means “all interfaces”.
Type: null or string
Default:
Example:
Declared by: - https://github.com/cachix/devenv/blob/main/src/modules/services/mosquitto.nix
services.mosquitto.extraConfig
Additional text to append to mosquitto.conf.
Type: strings concatenated with “\n”
Default:
Example:
Declared by: - https://github.com/cachix/devenv/blob/main/src/modules/services/mosquitto.nix
services.mosquitto.port
The TCP port to accept MQTT connections.
Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
Declared by: - https://github.com/cachix/devenv/blob/main/src/modules/services/mosquitto.nix