I enabled mDNS with
services.avahi = {
nssmdns = true;
enable = true;
ipv4 = true;
ipv6 = true;
publish = {
enable = true;
addresses = true;
workstation = true;
};
};
Originally, this works fine, I can access my network neighbours by their host names.
Then I enable the systemd-resolved with
services.resolved={
enable = true;
fallbackDns = [
"8.8.8.8"
"2001:4860:4860::8844"
];
};
Then my mDNS does not work.
I search the web pages e.g., the archlinux wiki , and find that some settings have to be set, for example, the MulticastDNS= in resolved.conf
, mdns= in the [connection] section of networkmanager
(yes, I’m using NetworkManager to manage my network).
But these settings seem not available in nixos’s options.
2 Likes
est31
April 3, 2021, 5:37pm
2
I think you might be running into this bug: mdns support for nss does not work when networkd is enabled · Issue #98050 · NixOS/nixpkgs · GitHub
It’s fixed on the master branch but not in the 20.09 release (which is the latest stable release):
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.avahi;
yesNo = yes : if yes then "yes" else "no";
avahiDaemonConf = with cfg; pkgs.writeText "avahi-daemon.conf" ''
[server]
${# Users can set `networking.hostName' to the empty string, when getting
# a host name from DHCP. In that case, let Avahi take whatever the
# current host name is; setting `host-name' to the empty string in
# `avahi-daemon.conf' would be invalid.
optionalString (hostName != "") "host-name=${hostName}"}
browse-domains=${concatStringsSep ", " browseDomains}
use-ipv4=${yesNo ipv4}
use-ipv6=${yesNo ipv6}
${optionalString (interfaces!=null) "allow-interfaces=${concatStringsSep "," interfaces}"}
This file has been truncated. show original
https://github.com/NixOS/nixpkgs/pull/99530