This commit is contained in:
Vinzenz Schroeter 2025-09-10 22:41:31 +02:00
parent ea0fb2b24d
commit f49c5f4fd2
2 changed files with 63 additions and 0 deletions

View file

@ -3,6 +3,7 @@
imports = [ imports = [
./hardware.nix ./hardware.nix
./vscode-server.nix ./vscode-server.nix
./hass.nix
]; ];
config = { config = {
nix.settings.extra-platforms = [ nix.settings.extra-platforms = [

View file

@ -0,0 +1,62 @@
{ pkgs, ... }:
let
hass-image = "ghcr.io/home-assistant/home-assistant:stable";
hass-service = "podman-homeassistant";
in
{
virtualisation.oci-containers = {
backend = "podman";
containers.homeassistant = {
image = hass-image;
hostname = "hass.lan";
serviceName = hass-service;
volumes = [ "home-assistant:/config" ];
environment.TZ = "Europe/Berlin";
extraOptions = [ "--network=host" ];
};
};
systemd = {
timers.update-hass = {
timerConfig = {
Unit = "update-hass.service";
OnCalendar = "Sun 02:00";
};
wantedBy = [ "timers.target" ];
};
services.update-hass = {
serviceConfig = {
Type = "oneshot";
ExecStart = pkgs.writeShellScriptBin "update-hass" ''
podman pull ${hass-image};
systemctl restart ${hass-service};
'';
};
};
};
services = {
mosquitto = {
enable = true;
};
nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
# TODO: add ssl
# TODO: add pam auth
virtualHosts."hass.lan" = {
locations."/" = {
proxyPass = "localhost:8123";
};
};
};
};
}