nixos-config/services/home-assistant/default.nix

108 lines
2.7 KiB
Nix
Raw Normal View History

{ config, pkgs, inputs, ... }:
2020-10-21 20:54:55 +02:00
2023-05-31 19:20:24 +02:00
let port = config.services.home-assistant.config.http.server_port;
in {
disabledModules = [ "services/home-automation/home-assistant.nix" ];
imports = [
"${inputs.nixpkgs-unstable}/nixos/modules/services/home-automation/home-assistant.nix"
./wyoming.nix
./esphome.nix
];
2021-02-16 03:43:33 +01:00
# just installed for ConBee firmware updates
2023-07-27 18:30:30 +02:00
environment.systemPackages = with pkgs; [ deconz ];
2020-10-07 14:37:57 +02:00
2020-10-22 19:15:55 +02:00
services.nginx = {
virtualHosts."${config.networking.domain}" = {
enableACME = true;
forceSSL = true;
extraConfig = ''
proxy_buffering off;
'';
locations."/" = {
proxyPass = "http://[::1]:${toString port}";
proxyWebsockets = true;
};
2020-10-22 19:15:55 +02:00
};
};
2020-10-21 20:54:55 +02:00
2020-10-03 16:32:06 +02:00
services.home-assistant = {
enable = true;
package = pkgs.unstable.home-assistant;
2020-10-03 16:32:06 +02:00
openFirewall = true;
2022-12-29 13:02:51 +01:00
extraComponents = [
"default_config"
"otp"
"upnp"
"zha"
"matter"
"esphome"
2022-12-29 13:02:51 +01:00
"homekit_controller"
"fritz"
2022-12-29 13:02:51 +01:00
"roku"
"sonos"
"onvif"
"alarm_control_panel"
"assist_pipeline"
"wyoming"
2022-12-29 13:02:51 +01:00
"shopping_list"
];
extraPackages = ps:
with ps; [
pyqrcode
# HACS
aiogithubapi
];
2020-10-03 16:32:06 +02:00
config = {
homeassistant = {
name = "Home";
latitude = "!secret latitude";
longitude = "!secret longitude";
elevation = 42;
2020-10-03 16:32:06 +02:00
unit_system = "metric";
2023-05-31 19:41:11 +02:00
country = "DE";
2020-10-03 16:32:06 +02:00
temperature_unit = "C";
external_url = "https://home.felschr.com";
internal_url = "http://192.168.1.102:8123";
media_dirs.media = "/media";
allowlist_external_dirs = [ "/tmp" "/config/www/tmp" ];
2020-10-03 16:32:06 +02:00
};
default_config = { };
http = {
use_x_forwarded_for = true;
trusted_proxies = [ "::1" ];
};
"automation editor" = "!include automations.yaml";
"scene editor" = "!include scenes.yaml";
"script editor" = "!include scripts.yaml";
recorder.purge_keep_days = 60;
2021-02-16 03:43:33 +01:00
zha = {
database_path = "/var/lib/hass/zigbee.db";
enable_quirks = true;
custom_quirks_path =
"${config.services.home-assistant.configDir}/zha_quirks/";
zigpy_config = { ota = { ikea_provider = true; }; };
2020-10-07 14:37:57 +02:00
};
zha_toolkit = { };
conversation = { intents = { }; };
2020-10-03 16:32:06 +02:00
};
# configWritable = true; # doesn't work atm
};
2022-10-25 12:08:38 +02:00
networking.firewall.allowedTCPPorts = [
1400 # Sonos discovery
];
networking.firewall.allowedUDPPorts = [
5353 # HomeKit
];
age.secrets.hass-secrets = {
file = ../../secrets/hass/secrets.age;
path = "/var/lib/hass/secrets.yaml";
owner = "hass";
group = "hass";
};
2020-10-03 16:32:06 +02:00
}