🏠 initial home-assistant setup

This commit is contained in:
2021-07-14 22:49:45 -04:00
parent 385a8793b0
commit bafa1a9b9e
5 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
{
# Use the docker container because it's officially supported.
virtualisation.oci-containers = {
containers = {
home-assistant = {
image = "ghcr.io/home-assistant/home-assistant:2021.7.2";
volumes =
[ "/var/lib/hass:/config" "/etc/localtime:/etc/localtime:ro" ];
extraOptions = [ "--privileged" "--network=host" ];
};
};
};
}

View File

@ -0,0 +1,17 @@
{ config, lib, pkgs, ... }:
{
services.nginx = {
enable = true;
virtualHosts = {
"hass.nerdhaus.ca" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://plato:8123";
proxyWebsockets = true;
};
};
};
};
}

View File

@ -0,0 +1,13 @@
{ config, lib, pkgs, ... }:
{
services = {
postgresql = {
ensureDatabases = [ "hass" ];
ensureUsers = [{
name = "hass";
ensurePermissions = { "DATABASE hass" = "ALL PRIVILEGES"; };
}];
};
};
}