Files
nixos/hosts/genesis/home-assistant.nix
T

123 lines
3.1 KiB
Nix
Raw Normal View History

2023-06-29 00:27:30 -05:00
{ config, pkgs, ... }:
let
service_list = [ "podman-home-assistant.service" ];
in
{
virtualisation.podman.enable = true;
services.home-assistant = {
enable = true;
configDir = "/var/lib/hass";
package = (pkgs.home-assistant.override {
extraComponents = [
"accuweather"
"calendar"
"cast"
"eufy"
"lovelace"
"nextcloud"
2024-02-13 15:09:50 -06:00
"piper"
2023-06-29 00:27:30 -05:00
"smart_meter_texas"
"solaredge"
"tplink"
2024-02-13 15:09:50 -06:00
"whisper"
2023-06-29 00:27:30 -05:00
"wiz"
2024-02-13 15:09:50 -06:00
"wyoming"
2023-06-29 00:27:30 -05:00
"zwave_js"
];
}).overrideAttrs (oldAttrs: {
doInstallCheck = false;
});
config = {
default_config = {};
tts = [ { platform = "google_translate"; } ];
http = {
use_x_forwarded_for = true;
trusted_proxies = [ "127.0.0.1" "::1" ];
server_host = "127.0.0.1";
};
#"automation manual" = *nix config here* and so on
2023-08-26 20:02:09 -05:00
"automation ui" = "!include automations.yaml";
"script ui" = "!include scripts.yaml";
"scene ui" = "!include scenes.yaml";
2023-06-29 00:27:30 -05:00
};
};
2024-02-13 15:09:50 -06:00
# Helps with Voice stuff for Home Assistant
services.wyoming = {
faster-whisper.servers = {
greg = {
enable = true;
beamSize = 1; # wut?
device = "auto"; # Could be CPU or CUDA
language = "en";
model = "base-int8";
uri = "tcp://0.0.0.0:13415";
};
};
piper.servers.greg = {
enable = true;
uri = "tcp://0.0.0.0:13416";
voice = "en_US-amy-medium";
};
};
2023-06-29 00:27:30 -05:00
# Although NixOS has a package for Home Assistant, it is not kept as up to date as the container and the upstream
# is very vocal about only supporting their own container or the HAOS deployments. So we deploy the container here
# and avoid any potential messes from that
virtualisation.oci-containers = {
backend = "podman";
# I have ZWave devices. The easiest way to connect to them is the zwavejs2mqtt service running, so we spin up
# its container and map the ZWave device into it
containers.zwave = {
2023-08-31 08:01:46 -05:00
image = "zwavejs/zwave-js-ui:latest";
2023-06-29 00:27:30 -05:00
ports = [ "8091:8091" "3000:3000" ];
volumes = [ "/var/lib/zwave:/usr/src/app/store" ];
extraOptions = [
"--device" "/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave"
"--pull=newer"
];
2023-08-31 08:01:46 -05:00
environment = {
TZ = "America/Chicago";
};
2023-06-29 00:27:30 -05:00
};
};
# Both of the above container need storage for their configuration and devices, but it is not created correctly by
# the container. So we add the creation of /var/lib/{zwave,hass} to the systemd Unit files
systemd.services = {
"podman-zwave".serviceConfig = {
StateDirectory = "zwave";
StateDirectoryMode = pkgs.lib.mkForce "0777";
};
};
2023-08-22 00:40:32 -05:00
greg.proxies = {
2023-09-05 11:06:35 -05:00
"smart.home".target = "http://127.0.0.1:8123/";
2023-12-29 22:40:23 -06:00
"smart.thehellings.lan".target = "http://127.0.0.1:8123/";
2023-09-05 11:06:35 -05:00
"zwave.home".target = "http://127.0.0.1:8091/";
2023-08-22 00:40:32 -05:00
};
2023-06-29 00:27:30 -05:00
# Ensure that both ports are up and running. We keep 8123 directly open because we are on the LAN and sometimes want to connect
# directly for troubleshooting Nginx configuration
networking.firewall = {
2023-09-05 11:06:35 -05:00
allowedTCPPorts = [ 80 443 ];
2023-06-29 00:27:30 -05:00
};
greg.backup.jobs.zwave = {
src = "/var/lib/zwave";
dest = "zwave";
user = "root";
};
2024-02-14 00:12:27 -06:00
greg.backup.jobs.nextcloud-backup = {
src = "/var/lib/hass";
dest = "hass";
user = "root";
};
2023-06-29 00:27:30 -05:00
}