From 1391d5c4d3a5d07a4c7e000e34b9a9c1c4bae98d Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Sep 2018 21:52:41 +0200 Subject: [PATCH] ma homeautomation: add mqtt --- 2configs/deployment/homeautomation/default.nix | 3 +++ 2configs/deployment/homeautomation/mqtt.nix | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 2configs/deployment/homeautomation/mqtt.nix diff --git a/2configs/deployment/homeautomation/default.nix b/2configs/deployment/homeautomation/default.nix index 1f935e2..bd87193 100644 --- a/2configs/deployment/homeautomation/default.nix +++ b/2configs/deployment/homeautomation/default.nix @@ -2,6 +2,9 @@ let firetv = "192.168.1.238"; in { + imports = [ + ./mqtt.nix + ]; systemd.services.firetv = { wantedBy = [ "multi-user.target" ]; serviceConfig = { diff --git a/2configs/deployment/homeautomation/mqtt.nix b/2configs/deployment/homeautomation/mqtt.nix new file mode 100644 index 0000000..1d6a6a3 --- /dev/null +++ b/2configs/deployment/homeautomation/mqtt.nix @@ -0,0 +1,16 @@ +{ pkgs, config, ... }: +{ + services.mosquitto = { + enable = true; + host = "0.0.0.0"; + allowAnonymous = false; + checkPasswords = true; + # see /mosquitto + users.sensor = { + hashedPassword = "$6$2DXU7W1bvqXPqxkF$vtdz5KTd/T09hmoc9LjgEGFjvpwQbQth6vlVcr5hJNLgcBHv4U03YCKC8TKXbmQAa8xiJ76xJIg25kcL+KI3tg=="; + acl = [ "topic readwrite #" ]; + }; + }; + environment.systemPackages = [ pkgs.mosquitto ]; + networking.firewall.allowedTCPPorts = [ config.services.mosquitto.port ]; +}