This repository has no description
1.9 kB
82 lines
1{ config, pkgs, ... }:
2{
3 imports = [
4 ./zigbee.nix
5 ];
6
7 krebs.iptables.tables.filter.INPUT.rules = [
8 {
9 predicate = "-i et0 -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 et0 -p tcp --dport 8123";
18 target = "ACCEPT";
19 } # hass
20 {
21 predicate = "-i et0 -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 systemctl restart podman-homeassistant.service
47 ${pkgs.podman}/bin/podman system prune -a --volumes -f
48 '';
49 };
50
51 virtualisation.oci-containers = {
52 backend = "podman";
53 containers.homeassistant = {
54 volumes = [ "home-assistant:/config" ];
55 environment.TZ = "Europe/Berlin";
56 image = "ghcr.io/home-assistant/home-assistant:stable"; # Warning: if the tag does not change, the image will not be updated
57 extraOptions = [
58 "--network=host"
59 ];
60 };
61 };
62
63 services.mosquitto = {
64 enable = true;
65 listeners = [
66 {
67 acl = [ ];
68 users.gg23 = {
69 acl = [ "readwrite #" ];
70 password = "gg23-mqtt";
71 };
72 }
73 ];
74 };
75
76 services.ollama = {
77 enable = true;
78 openFirewall = true;
79 };
80
81 environment.systemPackages = [ pkgs.mosquitto ];
82}