66 lines
1.4 KiB
Nix
66 lines
1.4 KiB
Nix
{ pkgs, common, ... }:
|
|
let
|
|
dbName = "hass";
|
|
domain = "beta.home.${common.domain}";
|
|
port = 8085;
|
|
in
|
|
{
|
|
|
|
services.home-assistant = {
|
|
enable = true;
|
|
package =
|
|
(pkgs.home-assistant.override {
|
|
extraPackages = py: with py; [ psycopg2 ];
|
|
}).overrideAttrs
|
|
(oldAttrs: {
|
|
# Avoid long install checks
|
|
doInstallCheck = false;
|
|
});
|
|
extraComponents = [
|
|
# Components required to complete the onboarding
|
|
"esphome"
|
|
"met"
|
|
"radio_browser"
|
|
];
|
|
config = {
|
|
# Includes dependencies for a basic setup
|
|
# https://www.home-assistant.io/integrations/default_config/
|
|
default_config = { };
|
|
homeassistant = {
|
|
name = "Hjem";
|
|
unit_system = "metric";
|
|
temperature_unit = "C";
|
|
};
|
|
http = {
|
|
server_host = "::1";
|
|
trusted_proxies = [ "::1" ];
|
|
use_x_forwarded_for = true;
|
|
server_port = port;
|
|
};
|
|
recorder.db_url = "postgresql://@/${dbName}";
|
|
};
|
|
};
|
|
|
|
services.nginx.virtualHosts.${domain} = {
|
|
forceSSL = true;
|
|
enableACME = true;
|
|
extraConfig = ''
|
|
proxy_buffering off;
|
|
'';
|
|
locations."/" = {
|
|
proxyPass = "http://[::1]:${toString port}";
|
|
proxyWebsockets = true;
|
|
};
|
|
};
|
|
services.postgresql = {
|
|
enable = true;
|
|
ensureDatabases = [ dbName ];
|
|
ensureUsers = [
|
|
{
|
|
name = dbName;
|
|
ensureDBOwnership = true;
|
|
}
|
|
];
|
|
};
|
|
}
|