2008-03-06 17:11:22 +00:00
|
|
|
{avahi, config, writeText, lib}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
avahiDaemonConf = with config; writeText "avahi-daemon.conf" ''
|
|
|
|
[server]
|
|
|
|
host-name=${hostName}
|
|
|
|
browse-domains=${lib.concatStringsSep ", " browseDomains}
|
|
|
|
use-ipv4=${if ipv4 then "yes" else "no"}
|
|
|
|
use-ipv6=${if ipv6 then "yes" else "no"}
|
|
|
|
|
|
|
|
[wide-area]
|
|
|
|
enable-wide-area=${if wideArea then "yes" else "no"}
|
|
|
|
|
|
|
|
[publish]
|
|
|
|
disable-publishing=${if publishing then "no" else "yes"}
|
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "avahi-daemon";
|
|
|
|
|
|
|
|
users = [
|
|
|
|
{ name = "avahi";
|
|
|
|
uid = (import ../system/ids.nix).uids.avahi;
|
|
|
|
description = "`avahi-daemon' privilege separation user";
|
|
|
|
home = "/var/empty";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2008-03-06 20:56:50 +00:00
|
|
|
groups = [
|
|
|
|
{ name = "avahi";
|
|
|
|
gid = (import ../system/ids.nix).gids.avahi;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2008-03-06 17:11:22 +00:00
|
|
|
job = ''
|
2008-03-26 16:41:31 +00:00
|
|
|
start on network-interfaces/started
|
|
|
|
stop on network-interfaces/stop
|
2008-03-06 17:11:22 +00:00
|
|
|
respawn
|
|
|
|
script
|
|
|
|
export PATH="${avahi}/bin:${avahi}/sbin:$PATH"
|
|
|
|
exec ${avahi}/sbin/avahi-daemon --daemonize -f "${avahiDaemonConf}"
|
|
|
|
end script
|
|
|
|
'';
|
|
|
|
|
|
|
|
}
|