avahi-daemon: refactored using some abstraction
This commit is contained in:
parent
a49481a740
commit
01a8de97eb
@ -7,32 +7,32 @@ let
|
|||||||
|
|
||||||
cfg = config.services.avahi;
|
cfg = config.services.avahi;
|
||||||
|
|
||||||
|
yesNo = yes : if yes then "yes" else "no";
|
||||||
|
|
||||||
avahiDaemonConf = with cfg; pkgs.writeText "avahi-daemon.conf" ''
|
avahiDaemonConf = with cfg; pkgs.writeText "avahi-daemon.conf" ''
|
||||||
[server]
|
[server]
|
||||||
${# Users can set `networking.hostName' to the empty string, when getting
|
${# Users can set `networking.hostName' to the empty string, when getting
|
||||||
# a host name from DHCP. In that case, let Avahi take whatever the
|
# 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
|
# current host name is; setting `host-name' to the empty string in
|
||||||
# `avahi-daemon.conf' would be invalid.
|
# `avahi-daemon.conf' would be invalid.
|
||||||
if hostName != ""
|
optionalString (hostName != "") "host-name=${hostName}"}
|
||||||
then "host-name=${hostName}"
|
|
||||||
else ""}
|
|
||||||
browse-domains=${concatStringsSep ", " browseDomains}
|
browse-domains=${concatStringsSep ", " browseDomains}
|
||||||
use-ipv4=${if ipv4 then "yes" else "no"}
|
use-ipv4=${yesNo ipv4}
|
||||||
use-ipv6=${if ipv6 then "yes" else "no"}
|
use-ipv6=${yesNo ipv6}
|
||||||
${optionalString (interfaces!=null) "allow-interfaces=${concatStringsSep "," interfaces}"}
|
${optionalString (interfaces!=null) "allow-interfaces=${concatStringsSep "," interfaces}"}
|
||||||
${optionalString (domainName!=null) "domain-name=${domainName}"}
|
${optionalString (domainName!=null) "domain-name=${domainName}"}
|
||||||
allow-point-to-point=${if allowPointToPoint then "yes" else "no"}
|
allow-point-to-point=${yesNo allowPointToPoint}
|
||||||
|
|
||||||
[wide-area]
|
[wide-area]
|
||||||
enable-wide-area=${if wideArea then "yes" else "no"}
|
enable-wide-area=${yesNo wideArea}
|
||||||
|
|
||||||
[publish]
|
[publish]
|
||||||
disable-publishing=${if publish.enable then "no" else "yes"}
|
disable-publishing=${yesNo (!publish.enable)}
|
||||||
disable-user-service-publishing=${if publish.userServices then "no" else "yes"}
|
disable-user-service-publishing=${yesNo (!publish.userServices)}
|
||||||
publish-addresses=${if publish.userServices || publish.addresses then "yes" else "no"}
|
publish-addresses=${yesNo (publish.userServices || publish.addresses)}
|
||||||
publish-hinfo=${if publish.hinfo then "yes" else "no"}
|
publish-hinfo=${yesNo publish.hinfo}
|
||||||
publish-workstation=${if publish.workstation then "yes" else "no"}
|
publish-workstation=${yesNo publish.workstation}
|
||||||
publish-domain=${if publish.domain then "yes" else "no"}
|
publish-domain=${yesNo publish.domain}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user