2007-11-23 10:56:12 +00:00
|
|
|
{config, pkgs, glibc, extraConfig}:
|
2006-12-18 19:20:03 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2007-11-09 18:49:45 +00:00
|
|
|
cfg = config.services.httpd;
|
|
|
|
cfgSvn = cfg.subservices.subversion;
|
2006-12-18 19:46:48 +00:00
|
|
|
|
2007-11-09 18:49:45 +00:00
|
|
|
optional = pkgs.lib.optional;
|
2006-12-19 01:03:15 +00:00
|
|
|
|
|
|
|
|
2008-03-12 12:21:12 +00:00
|
|
|
documentRoot = cfg.documentRoot;
|
2007-11-09 18:49:45 +00:00
|
|
|
hostName = cfg.hostName;
|
2008-06-03 14:30:37 +01:00
|
|
|
httpPort = cfg.port;
|
|
|
|
httpsPort = 443;
|
2007-11-09 18:49:45 +00:00
|
|
|
user = cfg.user;
|
|
|
|
group = cfg.group;
|
|
|
|
adminAddr = cfg.adminAddr;
|
|
|
|
logDir = cfg.logDir;
|
|
|
|
stateDir = cfg.stateDir;
|
2006-12-19 01:03:15 +00:00
|
|
|
enableSSL = false;
|
2008-01-28 15:40:29 +00:00
|
|
|
applicationMappings = cfg.mod_jk.applicationMappings;
|
|
|
|
|
2008-01-14 11:24:36 +00:00
|
|
|
startingDependency = if config.services.gw6c.enable && config.services.gw6c.autorun then "gw6c" else "network-interfaces";
|
2006-12-19 01:03:15 +00:00
|
|
|
|
2007-10-29 14:24:24 +00:00
|
|
|
webServer = import ../../services/apache-httpd {
|
2007-07-15 12:16:01 +01:00
|
|
|
inherit (pkgs) apacheHttpd coreutils;
|
2008-02-22 03:08:26 +00:00
|
|
|
stdenv = pkgs.stdenv;
|
2007-11-09 18:49:45 +00:00
|
|
|
php = if cfg.mod_php then pkgs.php else null;
|
2008-01-28 15:40:29 +00:00
|
|
|
tomcat_connectors = if cfg.mod_jk.enable then pkgs.tomcat_connectors else null;
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2008-03-12 12:21:12 +00:00
|
|
|
inherit documentRoot hostName httpPort httpsPort
|
2007-07-15 12:16:01 +01:00
|
|
|
user group adminAddr logDir stateDir
|
2008-02-20 17:03:48 +00:00
|
|
|
applicationMappings;
|
2007-12-12 15:30:17 +00:00
|
|
|
noUserDir = !cfg.enableUserDir;
|
2008-03-16 01:05:40 +00:00
|
|
|
extraDirectories = extraConfig + "\n" + cfg.extraConfig;
|
2006-12-19 01:03:15 +00:00
|
|
|
|
|
|
|
subServices =
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2006-12-19 01:03:15 +00:00
|
|
|
# The Subversion subservice.
|
2007-11-09 18:49:45 +00:00
|
|
|
(optional cfgSvn.enable (
|
|
|
|
let dataDir = cfgSvn.dataDir; in
|
2007-10-29 14:24:24 +00:00
|
|
|
import ../../services/subversion ({
|
2006-12-19 01:03:15 +00:00
|
|
|
reposDir = dataDir + "/repos";
|
|
|
|
dbDir = dataDir + "/db";
|
|
|
|
distsDir = dataDir + "/dist";
|
|
|
|
backupsDir = dataDir + "/backup";
|
|
|
|
tmpDir = dataDir + "/tmp";
|
|
|
|
|
2006-12-19 21:31:19 +00:00
|
|
|
inherit user group logDir adminAddr;
|
2006-12-19 01:03:15 +00:00
|
|
|
|
|
|
|
canonicalName =
|
|
|
|
if webServer.enableSSL then
|
|
|
|
"https://" + hostName + ":" + (toString httpsPort)
|
|
|
|
else
|
|
|
|
"http://" + hostName + ":" + (toString httpPort);
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2007-11-09 18:49:45 +00:00
|
|
|
notificationSender = cfgSvn.notificationSender;
|
|
|
|
autoVersioning = cfgSvn.autoVersioning;
|
|
|
|
userCreationDomain = cfgSvn.userCreationDomain;
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2006-12-19 01:03:15 +00:00
|
|
|
inherit pkgs;
|
2007-02-22 10:55:58 +00:00
|
|
|
} //
|
2007-11-09 18:49:45 +00:00
|
|
|
( if cfgSvn.organization.name != null then
|
2007-02-22 10:55:58 +00:00
|
|
|
{
|
2007-11-09 18:49:45 +00:00
|
|
|
orgName = cfgSvn.organization.name;
|
|
|
|
orgLogoFile = cfgSvn.organization.logo;
|
|
|
|
orgUrl = cfgSvn.organization.url;
|
2007-02-22 10:55:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
# use the default from the subversion service
|
|
|
|
{}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2007-02-20 15:11:49 +00:00
|
|
|
)
|
2008-02-20 17:03:48 +00:00
|
|
|
/* ++
|
2007-02-20 15:11:49 +00:00
|
|
|
|
2007-11-09 18:49:45 +00:00
|
|
|
(optional cfg.extraSubservices.enable
|
|
|
|
(map (service : service webServer pkgs) cfg.extraSubservices.services)
|
2008-02-20 17:03:48 +00:00
|
|
|
) */;
|
2006-12-18 19:20:03 +00:00
|
|
|
};
|
2006-12-19 01:03:15 +00:00
|
|
|
|
2006-12-18 19:20:03 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "httpd";
|
|
|
|
|
2007-06-08 16:41:12 +01:00
|
|
|
users = [
|
|
|
|
{ name = user;
|
|
|
|
description = "Apache httpd user";
|
|
|
|
}
|
|
|
|
];
|
2007-06-10 21:13:12 +01:00
|
|
|
|
|
|
|
groups = [
|
|
|
|
{ name = group;
|
|
|
|
}
|
|
|
|
];
|
2007-06-08 16:41:12 +01:00
|
|
|
|
2006-12-18 19:20:03 +00:00
|
|
|
job = "
|
|
|
|
description \"Apache HTTPD\"
|
|
|
|
|
2007-08-02 22:26:38 +01:00
|
|
|
start on ${startingDependency}/started
|
|
|
|
stop on ${startingDependency}/stop
|
2006-12-18 19:20:03 +00:00
|
|
|
|
|
|
|
start script
|
2006-12-18 19:46:48 +00:00
|
|
|
${webServer}/bin/control prepare
|
2006-12-18 19:20:03 +00:00
|
|
|
end script
|
|
|
|
|
2006-12-18 19:46:48 +00:00
|
|
|
respawn ${webServer}/bin/control run
|
2006-12-18 19:20:03 +00:00
|
|
|
";
|
|
|
|
|
|
|
|
}
|