From d8945920cb8e98dc737d1fc2d42607f5916c34cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 19 Apr 2024 15:31:53 +0200 Subject: [PATCH] mdns: don't enable it if we already have avahi (#417) --- nixos/mixins/mdns.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nixos/mixins/mdns.nix b/nixos/mixins/mdns.nix index af57459..85752e6 100644 --- a/nixos/mixins/mdns.nix +++ b/nixos/mixins/mdns.nix @@ -1,7 +1,10 @@ -{ lib, ... }: { - # Allows to find machines on the local network by name, i.e. useful for printer discovery - systemd.network.networks."99-ethernet-default-dhcp".networkConfig.MulticastDNS = lib.mkDefault "yes"; - systemd.network.networks."99-wireless-client-dhcp".networkConfig.MulticastDNS = lib.mkDefault "yes"; - networking.firewall.allowedUDPPorts = [ 5353 ]; # Multicast DNS +{ config, lib, ... }: +{ + # Avahi is an alternative implementation. If it's enabled, than we don't need the code below. + config = lib.mkIf (!config.services.avahi.enable) { + # Allows to find machines on the local network by name, i.e. useful for printer discovery + systemd.network.networks."99-ethernet-default-dhcp".networkConfig.MulticastDNS = lib.mkDefault "yes"; + systemd.network.networks."99-wireless-client-dhcp".networkConfig.MulticastDNS = lib.mkDefault "yes"; + networking.firewall.allowedUDPPorts = [ 5353 ]; # Multicast DNS + }; } -