Files
nix-config/modules/nixos/homeassistant/default.nix
mjallen18 e9084fe9ca fix
2025-11-25 13:32:31 -06:00

51 lines
1.1 KiB
Nix
Executable File

{
config,
lib,
pkgs,
namespace,
...
}:
let
cfg = config.${namespace}.services.home-assistant;
in
{
imports = [ ./options.nix ];
config = lib.mkIf cfg.enable {
# This bypasses the component validation and places it directly in HA's data directory
system.activationScripts.installCustomComponents = ''
chown -R hass:hass ${config.services.home-assistant.configDir}
chmod -R 750 ${config.services.home-assistant.configDir}
'';
services = {
protonmail-bridge = {
enable = true;
path = with pkgs; [ pass gnome-keyring ];
};
matter-server = {
enable = true;
port = 5580;
};
postgresql = {
enable = false;
ensureDatabases = [ "hass" ];
ensureUsers = [
{
name = "hass";
ensureDBOwnership = true;
}
];
};
};
networking.firewall.allowedTCPPorts = [
cfg.mosquittoPort
cfg.zigbee2mqttPort
8095 # music-assistant
8097 # home-assistant
5580 # matter-server
];
};
}