nixpkgs/upstart-jobs/avahi-daemon.nix
Ludovic Courtès f9cbd6e640 avahi-daemon: Start on `network-interfaces/started'.
svn path=/nixos/trunk/; revision=11291
2008-03-26 16:41:31 +00:00

48 lines
1 KiB
Nix

{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";
}
];
groups = [
{ name = "avahi";
gid = (import ../system/ids.nix).gids.avahi;
}
];
job = ''
start on network-interfaces/started
stop on network-interfaces/stop
respawn
script
export PATH="${avahi}/bin:${avahi}/sbin:$PATH"
exec ${avahi}/sbin/avahi-daemon --daemonize -f "${avahiDaemonConf}"
end script
'';
}