2023-07-12 12:28:45 +02:00
|
|
|
{config, ...}: let
|
2022-03-13 17:24:59 +01:00
|
|
|
port = 8123;
|
2023-07-12 12:28:45 +02:00
|
|
|
inherit (import ../../lib) restic;
|
2023-09-03 17:50:48 +02:00
|
|
|
influxPort = 9100;
|
2023-07-31 22:26:11 +02:00
|
|
|
volumeName = "home-assistant.bak";
|
2022-03-13 17:24:59 +01:00
|
|
|
in {
|
2023-09-03 17:50:48 +02:00
|
|
|
networking.firewall.allowedTCPPorts = [port influxPort];
|
2022-03-13 17:24:59 +01:00
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."home.kmein.r" = {
|
|
|
|
|
locations."/" = {
|
|
|
|
|
proxyPass = "http://127.0.0.1:${toString port}";
|
|
|
|
|
};
|
|
|
|
|
};
|
2022-03-10 22:59:43 +01:00
|
|
|
|
2023-09-03 17:50:48 +02:00
|
|
|
services.influxdb = {
|
|
|
|
|
enable = true;
|
|
|
|
|
extraConfig = {
|
|
|
|
|
http.bind-address = ":${toString influxPort}";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-07-12 12:28:45 +02:00
|
|
|
services.restic.backups.niveum = {
|
|
|
|
|
initialize = true;
|
|
|
|
|
inherit (restic) repository;
|
|
|
|
|
timerConfig = {
|
|
|
|
|
OnCalendar = "daily";
|
|
|
|
|
RandomizedDelaySec = "1h";
|
|
|
|
|
};
|
|
|
|
|
passwordFile = config.age.secrets.restic.path;
|
|
|
|
|
paths = [
|
2023-07-31 22:26:11 +02:00
|
|
|
"/var/lib/containers/storage/volumes/${volumeName}"
|
2023-07-12 12:28:45 +02:00
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-10 22:59:43 +01:00
|
|
|
virtualisation.oci-containers = {
|
|
|
|
|
backend = "podman";
|
|
|
|
|
containers.homeassistant = {
|
2023-07-31 22:26:11 +02:00
|
|
|
volumes = ["${volumeName}:/config"];
|
2022-03-10 22:59:43 +01:00
|
|
|
environment.TZ = "Europe/Berlin";
|
|
|
|
|
image = "ghcr.io/home-assistant/home-assistant:stable";
|
|
|
|
|
extraOptions = [
|
|
|
|
|
"--network=host"
|
2023-07-22 23:43:34 +02:00
|
|
|
"--device=/dev/ttyACM0:/dev/ttyACM0" # Example, change this to match your own hardware
|
2022-03-10 22:59:43 +01:00
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|