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