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 + }; } -