🏠 initial home-assistant setup

This commit is contained in:
James Walker 2021-07-14 22:49:45 -04:00
parent 385a8793b0
commit bafa1a9b9e
Signed by: walkah
GPG Key ID: 3C127179D6086E93
5 changed files with 47 additions and 0 deletions

View File

@ -9,6 +9,7 @@ in {
<home-manager/nixos>
../../modules/coredns
../../modules/home-assistant
../../modules/matrix
];

View File

@ -10,6 +10,7 @@ in {
<home-manager/nixos>
../../modules/coredns
../../modules/home-assistant/nginx.nix
../../modules/matrix/nginx.nix
];

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"; };
}];
};
};
}