wip hass
This commit is contained in:
parent
ea0fb2b24d
commit
f49c5f4fd2
2 changed files with 63 additions and 0 deletions
|
@ -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 = [
|
||||||
|
|
62
hosts/vinzenz-pc2/hass.nix
Normal file
62
hosts/vinzenz-pc2/hass.nix
Normal 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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue