Files
nix-config/modules/nixos/homeassistant/default.nix
mjallen18 61532d5149 maybe?
2025-11-25 14:43:38 -06:00

59 lines
1.3 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}
'';
# Configure systemd user service for protonmail-bridge
systemd.user.services.protonmail-bridge = {
environment = {
GNUPGHOME = "%h/.gnupg";
PASSWORD_STORE_DIR = "%h/.local/password-store";
};
};
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
];
};
}