svn path=/nixos/trunk/; revision=10686

This commit is contained in:
Eelco Dolstra 2008-02-14 13:37:09 +00:00
parent 94937ba2aa
commit 44fceb9c4d

View File

@ -8,6 +8,8 @@ let
httpd = pkgs.apacheHttpd; httpd = pkgs.apacheHttpd;
inherit (pkgs.lib) addDefaultOptionValues optional concatMap concatMapStrings;
makeServerInfo = cfg: { makeServerInfo = cfg: {
# Canonical name must not include a trailing slash. # Canonical name must not include a trailing slash.
@ -21,7 +23,7 @@ let
callSubservices = serverInfo: defs: callSubservices = serverInfo: defs:
let f = svc: let f = svc:
let config = pkgs.lib.addDefaultOptionValues res.options svc.config; let config = addDefaultOptionValues res.options svc.config;
res = svc.function {inherit config pkgs serverInfo;}; res = svc.function {inherit config pkgs serverInfo;};
in res; in res;
in map f defs; in map f defs;
@ -52,7 +54,7 @@ let
"mime" "dav" "status" "autoindex" "asis" "info" "cgi" "dav_fs" "mime" "dav" "status" "autoindex" "asis" "info" "cgi" "dav_fs"
"vhost_alias" "negotiation" "dir" "imagemap" "actions" "speling" "vhost_alias" "negotiation" "dir" "imagemap" "actions" "speling"
"userdir" "alias" "rewrite" "userdir" "alias" "rewrite"
] ++ pkgs.lib.optional cfg.enableSSL "ssl_module"; ] ++ optional cfg.enableSSL "ssl_module";
loggingConf = '' loggingConf = ''
@ -208,9 +210,9 @@ let
${let ${let
load = {name, path}: "LoadModule ${name}_module ${path}\n"; load = {name, path}: "LoadModule ${name}_module ${path}\n";
allModules = allModules =
pkgs.lib.concatMap (svc: svc.extraModulesPre) allSubservices ++ concatMap (svc: svc.extraModulesPre) allSubservices ++
map (name: {inherit name; path = "${httpd}/modules/mod_${name}.so";}) apacheModules ++ map (name: {inherit name; path = "${httpd}/modules/mod_${name}.so";}) apacheModules ++
pkgs.lib.concatMap (svc: svc.extraModules) allSubservices; concatMap (svc: svc.extraModules) allSubservices;
in concatMapStrings load allModules in concatMapStrings load allModules
} }
@ -287,7 +289,7 @@ let
makeVirtualHost = vhostIn: makeVirtualHost = vhostIn:
let let
# Fill in defaults for missing options. # Fill in defaults for missing options.
vhost = pkgs.lib.addDefaultOptionValues perServerOptions vhostIn; vhost = addDefaultOptionValues perServerOptions vhostIn;
in '' in ''
<VirtualHost *:*> <VirtualHost *:*>
${perServerConf false vhost} ${perServerConf false vhost}
@ -314,7 +316,7 @@ in
} }
]; ];
extraPath = [httpd] ++ pkgs.lib.concatMap (svc: svc.extraPath) allSubservices; extraPath = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
# Statically verify the syntactic correctness of the generated # Statically verify the syntactic correctness of the generated
# httpd.conf. # httpd.conf.
@ -344,7 +346,7 @@ in
${ ${
let f = {name, value}: "env ${name}=${value}\n"; let f = {name, value}: "env ${name}=${value}\n";
in pkgs.lib.concatStrings (map f (pkgs.lib.concatMap (svc: svc.globalEnvVars) allSubservices)) in concatMapStrings f (pkgs.lib.concatMap (svc: svc.globalEnvVars) allSubservices)
} }
env PATH=${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${pkgs.lib.concatStringsSep ":" (pkgs.lib.concatMap (svc: svc.extraServerPath) allSubservices)} env PATH=${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${pkgs.lib.concatStringsSep ":" (pkgs.lib.concatMap (svc: svc.extraServerPath) allSubservices)}