nixos-config/machines/raspite/hass.nix

51 lines
1.1 KiB
Nix
Raw Normal View History

2024-08-25 09:45:58 +00:00
{ config, pkgs, ... }:
{
2024-06-11 10:24:22 +00:00
services.home-assistant = {
enable = true;
extraComponents = [
"default_config"
"esphome"
"met"
"radio_browser"
];
openFirewall = false;
config = {
2024-08-25 09:45:58 +00:00
default_config = { };
2024-06-11 10:24:22 +00:00
http = {
server_host = "::1";
base_url = "raspite.local:1000";
use_x_forward_for = true;
2024-08-25 09:45:58 +00:00
trusted_proxies = [ "::1" ];
2024-06-11 10:24:22 +00:00
};
};
};
services.esphome = {
enable = true;
openFirewall = false;
};
users.groups.dialout.members = config.users.groups.wheel.members;
2024-08-25 09:45:58 +00:00
environment.systemPackages = with pkgs; [ zigbee2mqtt ];
2024-06-11 10:24:22 +00:00
2024-08-25 09:45:58 +00:00
networking.firewall.allowedTCPPorts = [
1000
1001
];
2024-06-11 10:24:22 +00:00
services.caddy = {
2024-08-25 09:45:58 +00:00
enable = true;
2024-06-11 10:24:22 +00:00
virtualHosts = {
2024-08-25 09:45:58 +00:00
# reverse_proxy ${config.services.home-assistant.config.http.server_host}:${toString config.services.home-assistant.config.http.server_port}
2024-06-11 10:24:22 +00:00
"raspite.local:1000".extraConfig = ''
reverse_proxy http://[::1]:8123
'';
"raspite.local:1001".extraConfig = ''
reverse_proxy ${config.services.esphome.address}:${toString config.services.esphome.port}
'';
};
};
}