mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 02:44:17 +03:00
f9cbd6e640
svn path=/nixos/trunk/; revision=11291
49 lines
1.0 KiB
Nix
49 lines
1.0 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
|
|
'';
|
|
|
|
}
|