From f7530dc5ee6b4a0118ff7456511fc2aa4693695c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 7 Sep 2012 10:58:53 +0200 Subject: [PATCH] avahi: Never set `host-name' to the empty string in `avahi-daemon.conf'. --- modules/services/networking/avahi-daemon.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/services/networking/avahi-daemon.nix b/modules/services/networking/avahi-daemon.nix index 791109dcda2..3603d677837 100644 --- a/modules/services/networking/avahi-daemon.nix +++ b/modules/services/networking/avahi-daemon.nix @@ -11,7 +11,13 @@ let avahiDaemonConf = with cfg; pkgs.writeText "avahi-daemon.conf" '' [server] - host-name=${hostName} + ${# 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. + if hostName != "" + then "host-name=${hostName}" + else ""} browse-domains=${concatStringsSep ", " browseDomains} use-ipv4=${if ipv4 then "yes" else "no"} use-ipv6=${if ipv6 then "yes" else "no"}