Add mqtt server (mosquitto)

The config was based on the exsisting mosquitto setup.
This commit is contained in:
christian 2024-06-10 15:38:48 +02:00 committed by echtnurich
parent c556475efd
commit 8a6820a418
Signed by: echtnurich
SSH key fingerprint: SHA256:1eIkxME0VPeXC2WMl9Haus+q0SLFymSAWU7f6Z+A8Aw
5 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,10 @@
{ ... }:
{
networking = {
hostName = "mqtt";
domain = "z9.ccchh.net";
};
system.stateVersion = "23.11";
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
imports = [
./configuration.nix
./networking.nix
./mosquitto.nix
];
}

View file

@ -0,0 +1,33 @@
# Sources for this configuration:
# - https://search.nixos.org/options?sort=relevance&type=packages&query=services.mosquitto
# - https://mosquitto.org/man/mosquitto-conf-5.html
# - https://winkekatze24.de
{ ... }:
{
services.mosquitto = {
enable = true;
persistence = true;
# set config for all listeners
listeners = [ {
settings.allow_anonymous = true;
omitPasswordAuth = true;
acl = ["topic readwrite #"];
} ];
bridges.winkekatz = {
addresses = [
{ address = "mqtt.winkekatze24.de"; }
];
topics = [
"winkekatze/allcats/eye/set in 2"
"winkekatze/allcats in 2"
"+/status out 2 winkekatze/ \"\""
"+/connected out 2 winkekatze/ \"\""
];
};
};
networking.firewall.allowedTCPPorts = [ 1883 ];
}

View file

@ -0,0 +1,20 @@
{ ... }:
{
networking = {
interfaces.net0 = {
ipv4.addresses = [ {
address = "10.31.208.14";
prefixLength = 23;
} ];
};
defaultGateway = "10.31.208.1";
nameservers = [
"10.31.210.1"
];
};
systemd.network.links."10-net0" = {
matchConfig.MACAddress = "BC:24:11:48:85:73";
linkConfig.Name = "net0";
};
}

View file

@ -196,6 +196,15 @@
./config/hosts/yate
];
};
mqtt = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./config/common
./config/proxmox-vm
./config/hosts/mqtt
];
};
};
packages.x86_64-linux = {