✨ [pi4] Initial Home-Assistant setup️
This commit is contained in:
@ -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
|
||||||
|
65
hosts/pi4/home-assitant.nix
Normal file
65
hosts/pi4/home-assitant.nix
Normal 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;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user