🏠 initial home-assistant setup
This commit is contained in:
15
modules/home-assistant/default.nix
Normal file
15
modules/home-assistant/default.nix
Normal 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" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
17
modules/home-assistant/nginx.nix
Normal file
17
modules/home-assistant/nginx.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
13
modules/home-assistant/postgresql.nix
Normal file
13
modules/home-assistant/postgresql.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
services = {
|
||||
postgresql = {
|
||||
ensureDatabases = [ "hass" ];
|
||||
ensureUsers = [{
|
||||
name = "hass";
|
||||
ensurePermissions = { "DATABASE hass" = "ALL PRIVILEGES"; };
|
||||
}];
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user