From 048af11455676826ffb975c03724276ab6e5bd03 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Wed, 8 May 2024 17:22:00 -0700 Subject: [PATCH] fix(z2m): it doesn't like ipv6 anymore..? --- modules/system/access.nix | 3 ++- nixos/zigbee2mqtt.nix | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/system/access.nix b/modules/system/access.nix index 99c954ba..30521a2f 100644 --- a/modules/system/access.nix +++ b/modules/system/access.nix @@ -108,13 +108,14 @@ portName ? "default", network ? "lan", scheme ? null, + getAddressFor ? "getAddressFor" }: let port = service.ports.${portName}; scheme' = if scheme == null then port.protocol else scheme; port' = if !port.enable then throw "${system.name}.exports.services.${service.name}.ports.${portName} isn't enabled" else ":${toString port.port}"; - host = access.getAddressFor system.name network; + host = access.${getAddressFor} system.name network; url = "${scheme'}://${mkAddress6 host}${port'}"; in assert service.enable; url; }; diff --git a/nixos/zigbee2mqtt.nix b/nixos/zigbee2mqtt.nix index 158299fe..5b10aaa7 100644 --- a/nixos/zigbee2mqtt.nix +++ b/nixos/zigbee2mqtt.nix @@ -27,7 +27,7 @@ in { user = "z2m"; password = "!secret z2m_pass"; server = let - url = access.proxyUrlFor { serviceName = "mosquitto"; scheme = "mqtt"; }; + url = access.proxyUrlFor { serviceName = "mosquitto"; scheme = "mqtt"; getAddressFor = "getAddress4For"; }; in mkIf (!config.services.mosquitto.enable) ( mkAlmostDefault url );