Add support for the Avahi daemon.

The daemon starts correctly but, for some reason, clients fail
to connect to it.

svn path=/nixos/trunk/; revision=10999
This commit is contained in:
Ludovic Courtès 2008-03-06 17:11:22 +00:00
parent ad1b5aca82
commit 43a4353c67
4 changed files with 101 additions and 1 deletions

View File

@ -11,6 +11,8 @@
vsftpd = 7;
ftp = 8;
bitlbee = 9;
avahi = 10;
nixbld = 30000; # start of range of uids
nobody = 65534;
};
@ -21,7 +23,9 @@
haldaemon = 5;
vsftpd = 7;
ftp = 8;
avahi = 10;
audio = 17;
users = 100;
nixbld = 30000;
nogroup = 65534;

View File

@ -914,12 +914,57 @@
};
avahi = {
enable = mkOption {
default = false;
description = ''
Whether to run the Avahi daemon, which allows Avahi clients
to use Avahi's service discovery facilities and also allows
the local machine to advertise its presence and services
(through the mDNS responder implemented by `avahi-daemon').
'';
};
hostName = mkOption {
default = "nixos"; # XXX: Would be nice to use `networking.hostName'.
description = ''Host name advertised on the LAN.'';
};
browseDomains = mkOption {
default = [ "0pointer.de" "zeroconf.org" ];
description = ''
List of non-local DNS domains to be browsed.
'';
};
ipv4 = mkOption {
default = true;
description = ''Whether to use IPv4'';
};
ipv6 = mkOption {
default = false;
description = ''Whether to use IPv6'';
};
wideArea = mkOption {
default = true;
description = ''Whether to enable wide-area service discovery.'';
};
publishing = mkOption {
default = true;
description = ''Whether to allow publishing.'';
};
};
bitlbee = {
enable = mkOption {
default = false;
description = ''
Whether the run the BitlBee IRC to other chat network gateway.
Whether to run the BitlBee IRC to other chat network gateway.
Running it allows you to access the MSN, Jabber, Yahoo! and ICQ chat
networks via an IRC client.
'';

View File

@ -0,0 +1,44 @@
{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"}
'';
avahiUid = (import ../system/ids.nix).uids.avahi;
in
{
name = "avahi-daemon";
users = [
{ name = "avahi";
uid = (import ../system/ids.nix).uids.avahi;
description = "`avahi-daemon' privilege separation user";
home = "/var/empty";
}
];
job = ''
start on startup
stop on shutdown
respawn
script
export PATH="${avahi}/bin:${avahi}/sbin:$PATH"
exec ${avahi}/sbin/avahi-daemon --daemonize -f "${avahiDaemonConf}"
end script
'';
}

View File

@ -157,6 +157,13 @@ let
servers = config.services.ntp.servers;
})
# Avahi daemon.
++ optional config.services.avahi.enable
(import ../upstart-jobs/avahi-daemon.nix {
inherit (pkgs) avahi writeText lib;
config = config.services.avahi;
})
# X server.
++ optional config.services.xserver.enable
(import ../upstart-jobs/xserver.nix {