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
|
|
|
|
|
|
|
|
2007-11-09 18:49:45 +00: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 01:03:15 +00:00
|
|
|
enableSSL = false;
|
2007-11-23 10:56:12 +00:00
|
|
|
extraDirectories = cfg.extraDirectories + extraConfig;
|
2007-08-02 21:26:38 +00:00
|
|
|
|
2007-11-09 18:49:45 +00:00
|
|
|
startingDependency = if config.services.gw6c.enable 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 11:16:01 +00:00
|
|
|
inherit (pkgs) apacheHttpd coreutils;
|
|
|
|
stdenv = pkgs.stdenvNewSetupScript;
|
2007-11-09 18:49:45 +00:00
|
|
|
php = if cfg.mod_php then pkgs.php else null;
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2006-12-19 01:03:15 +00:00
|
|
|
inherit hostName httpPort httpsPort
|
2007-07-15 11:16:01 +00:00
|
|
|
user group adminAddr logDir stateDir
|
2007-12-12 15:30:17 +00:00
|
|
|
extraDirectories;
|
|
|
|
noUserDir = !cfg.enableUserDir;
|
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
|
|
|
)
|
|
|
|
++
|
|
|
|
|
2007-11-09 18:49:45 +00:00
|
|
|
(optional cfg.extraSubservices.enable
|
|
|
|
(map (service : service webServer pkgs) cfg.extraSubservices.services)
|
|
|
|
);
|
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 15:41:12 +00:00
|
|
|
users = [
|
|
|
|
{ name = user;
|
|
|
|
description = "Apache httpd user";
|
|
|
|
}
|
|
|
|
];
|
2007-06-10 20:13:12 +00:00
|
|
|
|
|
|
|
groups = [
|
|
|
|
{ name = group;
|
|
|
|
}
|
|
|
|
];
|
2007-06-08 15:41:12 +00:00
|
|
|
|
2006-12-18 19:20:03 +00:00
|
|
|
job = "
|
|
|
|
description \"Apache HTTPD\"
|
|
|
|
|
2007-08-02 21:26:38 +00: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
|
|
|
";
|
|
|
|
|
|
|
|
}
|