Merge remote-tracking branch 'origin/master' into systemd

Conflicts:
	modules/services/system/nscd.nix
This commit is contained in:
Eelco Dolstra 2012-10-08 13:47:37 -04:00
commit dd3fe9d792
5 changed files with 41 additions and 54 deletions

View File

@ -18,13 +18,6 @@ let
};
localhostWithDomain = optionalString (cfg.domain != "")
"localhost.${cfg.domain}";
hostnameWithDomain = optionalString
(cfg.domain != "" && cfg.hostName != "")
"${cfg.hostName}.${cfg.domain}";
in
{
@ -49,9 +42,8 @@ in
{ # /etc/hosts: Hostname-to-IP mappings.
source = pkgs.writeText "hosts"
''
${optionalString (cfg.hostName != "")
"127.0.0.1 ${hostnameWithDomain} ${cfg.hostName}"}
127.0.0.1 localhost ${localhostWithDomain}
127.0.0.1 localhost
::1 localhost
${cfg.extraHosts}
'';
target = "hosts";

View File

@ -1,11 +0,0 @@
# NSS configuration files with mDNS enabled (requires running Avahi daemon).
passwd: ldap files
group: ldap files
shadow: ldap files
hosts: files mdns_minimal [NOTFOUND=return] dns mdns
networks: files dns
services: files
protocols: files

View File

@ -1,10 +0,0 @@
passwd: files ldap
group: files ldap
shadow: files ldap
hosts: files dns
networks: files dns
ethers: files
services: files
protocols: files

View File

@ -1,13 +1,15 @@
# Configuration for the Name Service Switch (/etc/nsswitch.conf).
{config, pkgs, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
let
options = {
# NSS modules. Hacky!
system.nssModules = pkgs.lib.mkOption {
system.nssModules = mkOption {
internal = true;
default = [];
description = "
@ -15,48 +17,49 @@ let
several DNS resolution methods to be specified via
<filename>/etc/nsswitch.conf</filename>.
";
merge = pkgs.lib.mergeListOption;
merge = mergeListOption;
apply = list:
let
list2 =
list
# !!! this should be in the LDAP module
++ pkgs.lib.optional config.users.ldap.enable pkgs.nss_ldap;
++ optional config.users.ldap.enable pkgs.nss_ldap;
in {
list = list2;
path = pkgs.lib.makeLibraryPath list2;
path = makeLibraryPath list2;
};
};
};
inherit (config.services.avahi) nssmdns;
in
{
require = [options];
require = [ options ];
environment.etc =
[ # Name Service Switch configuration file. Required by the C library.
# !!! Factor out the mdns stuff. The avahi module should define
# an option used by this module.
{ source =
if config.services.avahi.nssmdns
then ./nsswitch-mdns.conf
else ./nsswitch.conf;
{ source = pkgs.writeText "nsswitch.conf"
''
passwd: files ldap
group: files ldap
shadow: files ldap
hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} myhostname
networks: files dns
ethers: files
services: files
protocols: files
'';
target = "nsswitch.conf";
}
];
environment.shellInit =
if config.system.nssModules.path != "" then
''
LD_LIBRARY_PATH=${config.system.nssModules.path}:$LD_LIBRARY_PATH
''
else "";
# NSS modules need to be in `systemPath' so that (i) the builder
# chroot gets to seem them, and (ii) applications can benefit from
# changes in the list of NSS modules at run-time, without requiring
# a reboot.
environment.systemPackages = [config.system.nssModules.list];
# Use nss-myhostname to ensure that our hostname always resolves to
# a valid IP address. It returns all locally configured IP
# addresses, or ::1 and 127.0.0.2 as fallbacks.
system.nssModules = [ pkgs.nss_myhostname ];
}

View File

@ -10,7 +10,7 @@ let
''
base_dir = /var/run/dovecot2/
protocols = imap pop3
protocols = ${optionalString cfg.enableImap "imap"} ${optionalString cfg.enablePop3 "pop3"}
''
+ (if cfg.sslServerCert!="" then
''
@ -62,6 +62,16 @@ in
description = "Whether to enable the Dovecot 2.x POP3/IMAP server.";
};
enablePop3 = mkOption {
default = true;
description = "Start the POP3 listener (when Dovecot is enabled).";
};
enableImap = mkOption {
default = true;
description = "Start the IMAP listener (when Dovecot is enabled).";
};
user = mkOption {
default = "dovecot2";
description = "Dovecot user name.";
@ -146,6 +156,9 @@ in
environment.systemPackages = [ pkgs.dovecot ];
assertions = [{ assertion = cfg.enablePop3 || cfg.enableImap;
message = "dovecot needs at least one of the IMAP or POP3 listeners enabled";}];
};
}