{ povSelf, pkgs, lib, config, hostConfig, ... }: let inherit (lib) types; cfg = lib.getAttrFromPath povSelf config; in { option = { type = types.bool; default = false; }; config = lib.mkIf cfg { systemd.services = { mosquitto.requires = [ "mosquittoFixPerms.service" ]; mosquittoFixPerms.script = '' chown -R mosquitto:mosquitto /etc/mosquitto; ''; }; services.mosquitto = { enable = true; persistence = false; settings.max_keepalive = 60; listeners = [ { port = 1883; omitPasswordAuth = true; users = { }; settings = { allow_anonymous = true; }; acl = [ "topic readwrite #" "pattern readwrite #" ]; } { address = "::1"; port = 9005; omitPasswordAuth = true; users = { }; settings = { protocol = "websockets"; allow_anonymous = true; }; acl = [ "topic readwrite #" "pattern readwrite #" ]; } ]; }; }; }