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 in
{ {
@ -49,9 +42,8 @@ in
{ # /etc/hosts: Hostname-to-IP mappings. { # /etc/hosts: Hostname-to-IP mappings.
source = pkgs.writeText "hosts" source = pkgs.writeText "hosts"
'' ''
${optionalString (cfg.hostName != "") 127.0.0.1 localhost
"127.0.0.1 ${hostnameWithDomain} ${cfg.hostName}"} ::1 localhost
127.0.0.1 localhost ${localhostWithDomain}
${cfg.extraHosts} ${cfg.extraHosts}
''; '';
target = "hosts"; 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). # Configuration for the Name Service Switch (/etc/nsswitch.conf).
{config, pkgs, ...}: { config, pkgs, ... }:
with pkgs.lib;
let let
options = { options = {
# NSS modules. Hacky! # NSS modules. Hacky!
system.nssModules = pkgs.lib.mkOption { system.nssModules = mkOption {
internal = true; internal = true;
default = []; default = [];
description = " description = "
@ -15,48 +17,49 @@ let
several DNS resolution methods to be specified via several DNS resolution methods to be specified via
<filename>/etc/nsswitch.conf</filename>. <filename>/etc/nsswitch.conf</filename>.
"; ";
merge = pkgs.lib.mergeListOption; merge = mergeListOption;
apply = list: apply = list:
let let
list2 = list2 =
list list
# !!! this should be in the LDAP module # !!! 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 { in {
list = list2; list = list2;
path = pkgs.lib.makeLibraryPath list2; path = makeLibraryPath list2;
}; };
}; };
}; };
inherit (config.services.avahi) nssmdns;
in in
{ {
require = [options]; require = [ options ];
environment.etc = environment.etc =
[ # Name Service Switch configuration file. Required by the C library. [ # Name Service Switch configuration file. Required by the C library.
# !!! Factor out the mdns stuff. The avahi module should define # !!! Factor out the mdns stuff. The avahi module should define
# an option used by this module. # an option used by this module.
{ source = { source = pkgs.writeText "nsswitch.conf"
if config.services.avahi.nssmdns ''
then ./nsswitch-mdns.conf passwd: files ldap
else ./nsswitch.conf; 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"; target = "nsswitch.conf";
} }
]; ];
environment.shellInit = # Use nss-myhostname to ensure that our hostname always resolves to
if config.system.nssModules.path != "" then # a valid IP address. It returns all locally configured IP
'' # addresses, or ::1 and 127.0.0.2 as fallbacks.
LD_LIBRARY_PATH=${config.system.nssModules.path}:$LD_LIBRARY_PATH system.nssModules = [ pkgs.nss_myhostname ];
''
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];
} }

View File

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