config/modules/services/hass/default.nix

94 lines
2.0 KiB
Nix
Raw Normal View History

2023-11-14 07:01:02 +00:00
{
config,
lib,
2025-01-25 22:18:36 +00:00
pkgs,
2023-11-14 07:01:02 +00:00
myData,
...
2024-07-29 12:39:54 +00:00
}:
let
2023-11-14 07:01:02 +00:00
cfg = config.mj.services.hass;
2024-07-29 12:39:54 +00:00
in
{
2023-11-14 07:01:02 +00:00
options.mj.services.hass = with lib.types; {
enable = lib.mkEnableOption "Enable home-assistant";
};
config = lib.mkIf cfg.enable {
mj.services.friendlyport.ports = [
{
2024-07-29 12:39:54 +00:00
subnets = [ myData.subnets.tailscale.cidr ];
tcp = [ myData.ports.hass ];
2023-11-14 07:01:02 +00:00
}
];
2024-07-29 12:39:54 +00:00
environment.systemPackages = [ ];
2023-11-14 07:01:02 +00:00
services = {
home-assistant = {
enable = true;
extraComponents = [
"met"
"radio_browser"
2023-11-14 07:01:02 +00:00
# my stuff
"yamaha_musiccast"
"dlna_dmr"
2023-11-14 08:07:52 +00:00
"shelly"
2023-11-14 10:50:37 +00:00
"webostv"
2023-12-03 18:37:59 +00:00
"daikin"
2024-03-03 12:44:00 +00:00
"ipp"
2024-09-12 13:51:57 +00:00
"prometheus"
2023-11-14 07:01:02 +00:00
];
2025-01-25 22:18:36 +00:00
customComponents = [
pkgs.home-assistant-custom-components.frigate
];
2023-11-14 07:01:02 +00:00
config = {
2024-07-29 12:39:54 +00:00
default_config = { };
2023-11-14 16:29:44 +00:00
2023-11-14 07:01:02 +00:00
http = {
use_x_forwarded_for = true;
2024-08-03 13:55:08 +00:00
trusted_proxies = [ "127.0.0.1" ];
2023-11-14 07:01:02 +00:00
};
2024-09-12 13:42:29 +00:00
homeassistant = {
auth_providers = [
{
type = "trusted_networks";
trusted_networks = myData.subnets.motiejus.cidrs;
}
];
};
2023-11-14 16:29:44 +00:00
2024-07-29 12:39:54 +00:00
wake_on_lan = { };
2023-11-17 14:59:50 +00:00
2024-09-12 13:51:57 +00:00
prometheus = {
namespace = "hass";
2024-09-12 13:55:16 +00:00
requires_auth = false;
2024-09-12 13:51:57 +00:00
};
2023-11-17 14:59:50 +00:00
# requires a restore from backup
"automation ui" = "!include automations.yaml";
"automation yaml" = [
2023-11-14 16:29:44 +00:00
{
alias = "Turn On Living Room TV with WakeOnLan";
trigger = [
{
platform = "webostv.turn_on";
entity_id = "media_player.lg_webos_smart_tv";
}
];
action = [
{
service = "wake_on_lan.send_magic_packet";
2024-07-29 12:39:54 +00:00
data = {
mac = "74:e6:b8:4c:fb:b7";
};
2023-11-14 16:29:44 +00:00
}
];
}
];
2023-11-14 07:01:02 +00:00
};
};
};
};
}