started to break up home-assistant config

This commit is contained in:
Leyla Becker 2025-07-13 16:10:30 -05:00
parent b8e21e6c61
commit 0e8a148517
2 changed files with 31 additions and 2 deletions

View file

@ -280,6 +280,11 @@
subdomain = "home"; subdomain = "home";
openFirewall = true; openFirewall = true;
database = "postgres"; database = "postgres";
extensions = {
sonos.enable = true;
jellyfin.enable = true;
};
}; };
qbittorrent = { qbittorrent = {

View file

@ -21,6 +21,20 @@ in {
description = "what database do we want to use"; description = "what database do we want to use";
default = "builtin"; default = "builtin";
}; };
extensions = {
sonos = {
enable = lib.mkEnableOption "enable the sonos plugin";
port = lib.mkOption {
type = lib.types.int;
default = 1400;
description = "what port to use for sonos discovery";
};
};
jellyfin = {
enable = lib.mkEnableOption "enable the jellyfin plugin";
};
};
}; };
config = lib.mkIf config.services.home-assistant.enable (lib.mkMerge [ config = lib.mkIf config.services.home-assistant.enable (lib.mkMerge [
@ -50,11 +64,9 @@ in {
"radio_browser" "radio_browser"
"isal" "isal"
"zha" "zha"
"jellyfin"
"webostv" "webostv"
"tailscale" "tailscale"
"syncthing" "syncthing"
"sonos"
"analytics_insights" "analytics_insights"
"unifi" "unifi"
"openweathermap" "openweathermap"
@ -80,10 +92,22 @@ in {
]; ];
}; };
# TODO: configure /var/lib/hass/secrets.yaml via sops
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"f ${config.services.home-assistant.configDir}/automations.yaml 0755 hass hass" "f ${config.services.home-assistant.configDir}/automations.yaml 0755 hass hass"
]; ];
} }
(lib.mkIf (config.services.home-assistant.extensions.sonos.enable) {
services.home-assistant.extraComponents = ["sonos"];
networking.firewall.allowedTCPPorts = [
config.services.home-assistant.extensions.sonos.port
];
})
(lib.mkIf (config.services.home-assistant.extensions.jellyfin.enable) {
services.home-assistant.extraComponents = ["jellyfin"];
# TODO: configure port, address, and login information here
})
(lib.mkIf (config.services.home-assistant.database == "postgres") { (lib.mkIf (config.services.home-assistant.database == "postgres") {
host = { host = {
postgres = { postgres = {