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