forked from
lass.pds.lassul.us/superconfig
This repository has no description
1.7 kB
48 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 { predicate = "-i zttzibeakb -p tcp --dport 8123"; target = "ACCEPT"; } # hass
16 ];
17
18 systemd.services.hass-update = {
19 startAt = "daily";
20 script = ''
21 ${pkgs.podman}/bin/podman pull ${config.virtualisation.oci-containers.containers.homeassistant.image}
22 ${pkgs.podman}/bin/podman stop homeassistant
23 ${pkgs.podman}/bin/podman start homeassistant
24 '';
25 };
26
27 virtualisation.oci-containers = {
28 backend = "podman";
29 containers.homeassistant = {
30 volumes = [ "home-assistant:/config" ];
31 environment.TZ = "Europe/Berlin";
32 image = "ghcr.io/home-assistant/home-assistant:stable"; # Warning: if the tag does not change, the image will not be updated
33 extraOptions = [
34 "--network=host"
35 ];
36 };
37 };
38
39 services.mosquitto = {
40 enable = true;
41 listeners = [{
42 acl = [ ];
43 users.gg23 = { acl = [ "readwrite #" ]; password = "gg23-mqtt"; };
44 }];
45 };
46
47 environment.systemPackages = [ pkgs.mosquitto ];
48}