Add mqtt server (mosquitto)
The config was based on the exsisting mosquitto setup.
This commit is contained in:
parent
c556475efd
commit
8a6820a418
5 changed files with 81 additions and 0 deletions
10
config/hosts/mqtt/configuration.nix
Normal file
10
config/hosts/mqtt/configuration.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
hostName = "mqtt";
|
||||
domain = "z9.ccchh.net";
|
||||
};
|
||||
|
||||
system.stateVersion = "23.11";
|
||||
}
|
9
config/hosts/mqtt/default.nix
Normal file
9
config/hosts/mqtt/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./configuration.nix
|
||||
./networking.nix
|
||||
./mosquitto.nix
|
||||
];
|
||||
}
|
33
config/hosts/mqtt/mosquitto.nix
Normal file
33
config/hosts/mqtt/mosquitto.nix
Normal 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 ];
|
||||
}
|
20
config/hosts/mqtt/networking.nix
Normal file
20
config/hosts/mqtt/networking.nix
Normal 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";
|
||||
};
|
||||
}
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue