2007-06-10 22:13:12 +02:00
|
|
|
{config, pkgs, glibc}:
|
2006-12-18 20:20:03 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2006-12-18 20:46:48 +01:00
|
|
|
getCfg = option: config.get ["services" "httpd" option];
|
2007-02-20 16:11:49 +01:00
|
|
|
getCfgs = options: config.get (["services" "httpd"] ++ options);
|
2006-12-19 02:03:15 +01:00
|
|
|
getCfgSvn = option: config.get ["services" "httpd" "subservices" "subversion" option];
|
2007-02-22 11:55:58 +01:00
|
|
|
getCfgsSvn = options: config.get (["services" "httpd" "subservices" "subversion"] ++ options);
|
2006-12-18 20:46:48 +01:00
|
|
|
|
2006-12-19 02:03:15 +01:00
|
|
|
optional = conf: subService:
|
|
|
|
if conf then [subService] else [];
|
|
|
|
|
|
|
|
|
|
|
|
hostName = getCfg "hostName";
|
|
|
|
httpPort = getCfg "httpPort";
|
|
|
|
httpsPort = getCfg "httpsPort";
|
2006-12-18 20:46:48 +01:00
|
|
|
user = getCfg "user";
|
|
|
|
group = getCfg "group";
|
2006-12-19 02:03:15 +01:00
|
|
|
adminAddr = getCfg "adminAddr";
|
|
|
|
logDir = getCfg "logDir";
|
|
|
|
stateDir = getCfg "stateDir";
|
|
|
|
enableSSL = false;
|
2007-07-15 13:16:01 +02:00
|
|
|
noUserDir = getCfg "noUserDir";
|
|
|
|
extraDirectories = getCfg "extraDirectories";
|
2007-08-02 23:26:38 +02:00
|
|
|
|
|
|
|
startingDependency = if (config.get [ "services" "gw6c" "enable" ])
|
|
|
|
then "gw6c" else "network-interfaces";
|
2006-12-19 02:03:15 +01:00
|
|
|
|
2006-12-18 20:20:03 +01:00
|
|
|
webServer = import ../services/apache-httpd {
|
2007-07-15 13:16:01 +02:00
|
|
|
inherit (pkgs) apacheHttpd coreutils;
|
|
|
|
stdenv = pkgs.stdenvNewSetupScript;
|
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-02-20 16:11:49 +01:00
|
|
|
(optional (getCfgSvn "enable") (
|
2006-12-19 02:03:15 +01:00
|
|
|
let dataDir = getCfgSvn "dataDir"; in
|
2007-02-22 11:55:58 +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
|
|
|
|
2006-12-19 02:03:15 +01:00
|
|
|
notificationSender = getCfgSvn "notificationSender";
|
|
|
|
autoVersioning = getCfgSvn "autoVersioning";
|
2007-02-12 12:57:18 +01:00
|
|
|
userCreationDomain = getCfgSvn "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
|
|
|
} //
|
|
|
|
( if getCfgsSvn ["organization" "name"] != null then
|
|
|
|
{
|
|
|
|
orgName = getCfgsSvn ["organization" "name"];
|
|
|
|
orgLogoFile = getCfgsSvn ["organization" "logo"];
|
|
|
|
orgUrl = getCfgsSvn ["organization" "url"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
# use the default from the subversion service
|
|
|
|
{}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2007-02-20 16:11:49 +01:00
|
|
|
)
|
|
|
|
++
|
|
|
|
|
2007-02-20 16:57:15 +01:00
|
|
|
(optional (getCfgs ["extraSubservices" "enable"])
|
|
|
|
(map (service : service webServer pkgs)
|
|
|
|
(getCfgs ["extraSubservices" "services"])
|
2007-02-20 16:11:49 +01:00
|
|
|
)
|
|
|
|
)
|
2006-12-19 02:03:15 +01:00
|
|
|
;
|
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
|
|
|
";
|
|
|
|
|
|
|
|
}
|