2009-03-06 12:26:41 +00:00
|
|
|
{pkgs, config, ...}:
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
let
|
|
|
|
inherit (pkgs.lib) mkOption mkIf;
|
|
|
|
|
|
|
|
# options have been moved to the apache-httpd/default.nix file
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
###### implementation
|
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";
|
2009-03-06 12:26:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
extraConfig = pkgs.lib.concatStringsSep "\n"
|
|
|
|
(pkgs.lib.catAttrs "extraHttpdConfig" config.services.extraJobs);
|
|
|
|
|
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;
|
2009-03-06 12:26:41 +00:00
|
|
|
|
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
|
|
|
|
{}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2009-03-06 12:26:41 +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
|
|
|
|
|
2009-03-06 12:26:41 +00:00
|
|
|
mkIf (config.services.httpd.enable && !config.services.httpd.experimental) {
|
2007-06-10 21:13:12 +01:00
|
|
|
|
2009-03-06 12:26:41 +00:00
|
|
|
require = [
|
|
|
|
# options have been moved to the apache-httpd/default.nix file
|
2007-06-10 21:13:12 +01:00
|
|
|
];
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2009-03-06 12:26:41 +00:00
|
|
|
users = {
|
|
|
|
extraUsers = [
|
|
|
|
{ name = user;
|
|
|
|
description = "Apache httpd user";
|
|
|
|
}
|
|
|
|
];
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2009-03-06 12:26:41 +00:00
|
|
|
extraGroups = [
|
|
|
|
{ name = group;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2009-03-06 12:26:41 +00:00
|
|
|
services = {
|
|
|
|
extraJobs = [{
|
|
|
|
name = "httpd";
|
|
|
|
|
|
|
|
job = ''
|
|
|
|
description \"Apache HTTPD\"
|
|
|
|
|
|
|
|
start on ${startingDependency}/started
|
|
|
|
stop on ${startingDependency}/stop
|
|
|
|
|
|
|
|
start script
|
|
|
|
${webServer}/bin/control prepare
|
|
|
|
end script
|
|
|
|
|
|
|
|
respawn ${webServer}/bin/control run
|
|
|
|
'';
|
2006-12-18 19:20:03 +00:00
|
|
|
|
2009-03-06 12:26:41 +00:00
|
|
|
}];
|
|
|
|
};
|
2006-12-18 19:20:03 +00:00
|
|
|
}
|