This repository has no description
1.6 kB
47 lines
1{ config, pkgs, ... }:
2{
3 imports = [
4 ./zigbee.nix
5 ];
6
7 krebs.iptables.tables.filter.INPUT.rules = [
8 { predicate = "-i int0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
9 { predicate = "-i docker0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
10 { predicate = "-i int0 -p tcp --dport 8123"; target = "ACCEPT"; } # hass
11 { predicate = "-i int0 -p tcp --dport 1337"; target = "ACCEPT"; } # zigbee2mqtt frontend
12 { predicate = "-i retiolum -p tcp --dport 8123"; target = "ACCEPT"; } # hass
13 { predicate = "-i retiolum -p tcp --dport 1337"; target = "ACCEPT"; } # zigbee2mqtt frontend
14 { predicate = "-i wiregrill -p tcp --dport 8123"; target = "ACCEPT"; } # hass
15 ];
16
17 systemd.services.hass-update = {
18 startAt = "daily";
19 script = ''
20 ${pkgs.podman}/bin/podman pull ${config.virtualisation.oci-containers.containers.homeassistant.image}
21 ${pkgs.podman}/bin/podman stop homeassistant
22 ${pkgs.podman}/bin/podman start homeassistant
23 '';
24 };
25
26 virtualisation.oci-containers = {
27 backend = "podman";
28 containers.homeassistant = {
29 volumes = [ "home-assistant:/config" ];
30 environment.TZ = "Europe/Berlin";
31 image = "ghcr.io/home-assistant/home-assistant:stable"; # Warning: if the tag does not change, the image will not be updated
32 extraOptions = [
33 "--network=host"
34 ];
35 };
36 };
37
38 services.mosquitto = {
39 enable = true;
40 listeners = [{
41 acl = [ ];
42 users.gg23 = { acl = [ "readwrite #" ]; password = "gg23-mqtt"; };
43 }];
44 };
45
46 environment.systemPackages = [ pkgs.mosquitto ];
47}