From 283c410ca67b6b74c25eee31c67d1a839021e2ec Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 8 Apr 2023 22:15:10 +0200 Subject: [PATCH] home-assistant: add a stub network interface in c3d2 for mdns --- hosts/home-assistant/default.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hosts/home-assistant/default.nix b/hosts/home-assistant/default.nix index e572eb22..b8ba29da 100644 --- a/hosts/home-assistant/default.nix +++ b/hosts/home-assistant/default.nix @@ -1,13 +1,37 @@ { config, pkgs, ... }: +let + c3d2MacAddress = "00:0b:ad:00:1d:ea"; + +in { c3d2.deployment.server = "server10"; microvm = { mem = 1 * 1024; vcpu = 2; + # add a network interface in c3d2 for mDNS + interfaces = [ { + type = "tap"; + id = builtins.substring 0 15 "c3d2-${config.networking.hostName}"; + mac = c3d2MacAddress; + } ]; }; networking.hostName = "home-assistant"; + systemd.network = { + links."40-c3d2" = { + matchConfig.MACAddress = c3d2MacAddress; + # rename interface to net name + linkConfig.Name = "c3d2"; + }; + networks."40-c3d2" = { + matchConfig.MACAddress = c3d2MacAddress; + networkConfig = { + LinkLocalAddressing = "yes"; + IPv6AcceptRA = "no"; + }; + }; + }; services = { avahi.enable = true;