This repository has no description
1.6 kB
58 lines
1{ config, pkgs, ... }:
2{
3 imports = [
4 ./zigbee.nix
5 ./monitoring.nix
6 ./oidc.nix
7 ];
8
9 # Runs on the gg23 router: the LAN (int0) is a trusted interface there
10 # (configs/gg23.nix), et0 is the WAN and stays closed.
11 networking.firewall.interfaces = {
12 retiolum.allowedTCPPorts = [
13 8123 # hass
14 1337 # zigbee2mqtt frontend
15 ];
16 wiregrill.allowedTCPPorts = [ 8123 ]; # hass
17 zttzibeakb.allowedTCPPorts = [ 8123 ]; # hass
18 };
19
20 systemd.services.hass-update = {
21 startAt = "daily";
22 script = ''
23 ${pkgs.podman}/bin/podman pull ${config.virtualisation.oci-containers.containers.homeassistant.image}
24 systemctl restart podman-homeassistant.service
25 ${pkgs.podman}/bin/podman system prune -a --volumes -f
26 '';
27 };
28
29 virtualisation.oci-containers = {
30 backend = "podman";
31 containers.homeassistant = {
32 volumes = [ "home-assistant:/config" ];
33 environment.TZ = "Europe/Berlin";
34 image = "ghcr.io/home-assistant/home-assistant:stable"; # Warning: if the tag does not change, the image will not be updated
35 extraOptions = [
36 "--network=host"
37 ];
38 };
39 };
40
41 services.mosquitto = {
42 enable = true;
43 listeners = [
44 {
45 acl = [ ];
46 users.gg23 = {
47 acl = [ "readwrite #" ];
48 password = "gg23-mqtt";
49 };
50 }
51 ];
52 };
53
54 environment.systemPackages = [ pkgs.mosquitto ];
55
56 # retained messages; mosquitto.db is replaced atomically on every save
57 lass.backup.state.mosquitto.folders = [ config.services.mosquitto.dataDir ];
58}