[pi4] Initial Home-Assistant setup️

This commit is contained in:
2025-08-10 13:10:21 +00:00
parent 49c60b3519
commit c4160fef76
2 changed files with 66 additions and 0 deletions

View File

@ -9,6 +9,7 @@
./forgejo.nix ./forgejo.nix
./hardware.nix ./hardware.nix
./headscale.nix ./headscale.nix
./home-assitant.nix
./mailserver.nix ./mailserver.nix
./nextcloud.nix ./nextcloud.nix
./nginx.nix ./nginx.nix

View File

@ -0,0 +1,65 @@
{ 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;
}
];
};
}