Convert "httpd" and "apache-httpd"
svn path=/nixos/branches/fix-style/; revision=14382
This commit is contained in:
parent
e95773a38f
commit
e7b7d62777
@ -479,202 +479,6 @@ in
|
||||
|
||||
};
|
||||
|
||||
|
||||
httpd = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Apache httpd server.
|
||||
";
|
||||
};
|
||||
|
||||
experimental = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to use the new-style Apache configuration.
|
||||
";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
These configuration lines will be passed verbatim to the apache config
|
||||
";
|
||||
};
|
||||
|
||||
extraModules = mkOption {
|
||||
default = [];
|
||||
example = [ "proxy_connect" { name = "php5_module"; path = "${pkgs.php}/modules/libphp5.so"; } ];
|
||||
description = ''
|
||||
Specifies additional Apache modules. These can be specified
|
||||
as a string in the case of modules distributed with Apache,
|
||||
or as an attribute set specifying the
|
||||
<varname>name</varname> and <varname>path</varname> of the
|
||||
module.
|
||||
'';
|
||||
};
|
||||
|
||||
logPerVirtualHost = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
If enabled, each virtual host gets its own
|
||||
<filename>access_log</filename> and
|
||||
<filename>error_log</filename>, namely suffixed by the
|
||||
<option>hostName</option> of the virtual host.
|
||||
";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
default = "wwwrun";
|
||||
description = "
|
||||
User account under which httpd runs. The account is created
|
||||
automatically if it doesn't exist.
|
||||
";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
default = "wwwrun";
|
||||
description = "
|
||||
Group under which httpd runs. The account is created
|
||||
automatically if it doesn't exist.
|
||||
";
|
||||
};
|
||||
|
||||
logDir = mkOption {
|
||||
default = "/var/log/httpd";
|
||||
description = "
|
||||
Directory for Apache's log files. It is created automatically.
|
||||
";
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
default = "/var/run/httpd";
|
||||
description = "
|
||||
Directory for Apache's transient runtime state (such as PID
|
||||
files). It is created automatically. Note that the default,
|
||||
<filename>/var/run/httpd</filename>, is deleted at boot time.
|
||||
";
|
||||
};
|
||||
|
||||
mod_php = mkOption {
|
||||
default = false;
|
||||
description = "Whether to enable the PHP module.";
|
||||
};
|
||||
|
||||
mod_jk = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "Whether to enable the Apache Tomcat connector.";
|
||||
};
|
||||
|
||||
applicationMappings = mkOption {
|
||||
default = [];
|
||||
description = "List of Java webapplications that should be mapped to the servlet container (Tomcat/JBoss)";
|
||||
};
|
||||
};
|
||||
|
||||
virtualHosts = mkOption {
|
||||
default = [];
|
||||
example = [
|
||||
{ hostName = "foo";
|
||||
documentRoot = "/data/webroot-foo";
|
||||
}
|
||||
{ hostName = "bar";
|
||||
documentRoot = "/data/webroot-bar";
|
||||
}
|
||||
];
|
||||
description = ''
|
||||
Specification of the virtual hosts served by Apache. Each
|
||||
element should be an attribute set specifying the
|
||||
configuration of the virtual host. The available options
|
||||
are the non-global options permissible for the main host.
|
||||
'';
|
||||
};
|
||||
|
||||
subservices = {
|
||||
|
||||
# !!! remove this
|
||||
subversion = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Subversion subservice in the webserver.
|
||||
";
|
||||
};
|
||||
|
||||
notificationSender = mkOption {
|
||||
default = "svn-server@example.org";
|
||||
example = "svn-server@example.org";
|
||||
description = "
|
||||
The email address used in the Sender field of commit
|
||||
notification messages sent by the Subversion subservice.
|
||||
";
|
||||
};
|
||||
|
||||
userCreationDomain = mkOption {
|
||||
default = "example.org";
|
||||
example = "example.org";
|
||||
description = "
|
||||
The domain from which user creation is allowed. A client can
|
||||
only create a new user account if its IP address resolves to
|
||||
this domain.
|
||||
";
|
||||
};
|
||||
|
||||
autoVersioning = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether you want the Subversion subservice to support
|
||||
auto-versioning, which enables Subversion repositories to be
|
||||
mounted as read/writable file systems on operating systems that
|
||||
support WebDAV.
|
||||
";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
default = "/no/such/path/exists";
|
||||
description = "
|
||||
Place to put SVN repository.
|
||||
";
|
||||
};
|
||||
|
||||
organization = {
|
||||
|
||||
name = mkOption {
|
||||
default = null;
|
||||
description = "
|
||||
Name of the organization hosting the Subversion service.
|
||||
";
|
||||
};
|
||||
|
||||
url = mkOption {
|
||||
default = null;
|
||||
description = "
|
||||
URL of the website of the organization hosting the Subversion service.
|
||||
";
|
||||
};
|
||||
|
||||
logo = mkOption {
|
||||
default = null;
|
||||
description = "
|
||||
Logo the organization hosting the Subversion service.
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
} // # Include the options shared between the main server and virtual hosts.
|
||||
(import ../upstart-jobs/apache-httpd/per-server-options.nix {
|
||||
inherit mkOption;
|
||||
forMainServer = true;
|
||||
});
|
||||
|
||||
vsftpd = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
@ -1256,6 +1060,8 @@ in
|
||||
(import ../upstart-jobs/ejabberd.nix) # untested, dosen't compile on x86_64-linux
|
||||
(import ../upstart-jobs/jboss.nix)
|
||||
(import ../upstart-jobs/tomcat.nix) # untested, too lazy to get that jdk
|
||||
(import ../upstart-jobs/httpd.nix) # Apache httpd (probably this can be removed ?)
|
||||
(import ../upstart-jobs/apache-httpd) # Apache httpd (new style).
|
||||
|
||||
# nix
|
||||
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
||||
|
@ -1,6 +1,209 @@
|
||||
{config, pkgs}:
|
||||
{pkgs, config, ...}:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption mkIf;
|
||||
|
||||
options = {
|
||||
services = {
|
||||
httpd = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Apache httpd server.
|
||||
";
|
||||
};
|
||||
|
||||
experimental = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to use the new-style Apache configuration.
|
||||
";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
These configuration lines will be passed verbatim to the apache config
|
||||
";
|
||||
};
|
||||
|
||||
extraModules = mkOption {
|
||||
default = [];
|
||||
example = [ "proxy_connect" { name = "php5_module"; path = "${pkgs.php}/modules/libphp5.so"; } ];
|
||||
description = ''
|
||||
Specifies additional Apache modules. These can be specified
|
||||
as a string in the case of modules distributed with Apache,
|
||||
or as an attribute set specifying the
|
||||
<varname>name</varname> and <varname>path</varname> of the
|
||||
module.
|
||||
'';
|
||||
};
|
||||
|
||||
logPerVirtualHost = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
If enabled, each virtual host gets its own
|
||||
<filename>access_log</filename> and
|
||||
<filename>error_log</filename>, namely suffixed by the
|
||||
<option>hostName</option> of the virtual host.
|
||||
";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
default = "wwwrun";
|
||||
description = "
|
||||
User account under which httpd runs. The account is created
|
||||
automatically if it doesn't exist.
|
||||
";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
default = "wwwrun";
|
||||
description = "
|
||||
Group under which httpd runs. The account is created
|
||||
automatically if it doesn't exist.
|
||||
";
|
||||
};
|
||||
|
||||
logDir = mkOption {
|
||||
default = "/var/log/httpd";
|
||||
description = "
|
||||
Directory for Apache's log files. It is created automatically.
|
||||
";
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
default = "/var/run/httpd";
|
||||
description = "
|
||||
Directory for Apache's transient runtime state (such as PID
|
||||
files). It is created automatically. Note that the default,
|
||||
<filename>/var/run/httpd</filename>, is deleted at boot time.
|
||||
";
|
||||
};
|
||||
|
||||
mod_php = mkOption {
|
||||
default = false;
|
||||
description = "Whether to enable the PHP module.";
|
||||
};
|
||||
|
||||
mod_jk = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "Whether to enable the Apache Tomcat connector.";
|
||||
};
|
||||
|
||||
applicationMappings = mkOption {
|
||||
default = [];
|
||||
description = "List of Java webapplications that should be mapped to the servlet container (Tomcat/JBoss)";
|
||||
};
|
||||
};
|
||||
|
||||
virtualHosts = mkOption {
|
||||
default = [];
|
||||
example = [
|
||||
{ hostName = "foo";
|
||||
documentRoot = "/data/webroot-foo";
|
||||
}
|
||||
{ hostName = "bar";
|
||||
documentRoot = "/data/webroot-bar";
|
||||
}
|
||||
];
|
||||
description = ''
|
||||
Specification of the virtual hosts served by Apache. Each
|
||||
element should be an attribute set specifying the
|
||||
configuration of the virtual host. The available options
|
||||
are the non-global options permissible for the main host.
|
||||
'';
|
||||
};
|
||||
|
||||
subservices = {
|
||||
|
||||
# !!! remove this
|
||||
subversion = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Subversion subservice in the webserver.
|
||||
";
|
||||
};
|
||||
|
||||
notificationSender = mkOption {
|
||||
default = "svn-server@example.org";
|
||||
example = "svn-server@example.org";
|
||||
description = "
|
||||
The email address used in the Sender field of commit
|
||||
notification messages sent by the Subversion subservice.
|
||||
";
|
||||
};
|
||||
|
||||
userCreationDomain = mkOption {
|
||||
default = "example.org";
|
||||
example = "example.org";
|
||||
description = "
|
||||
The domain from which user creation is allowed. A client can
|
||||
only create a new user account if its IP address resolves to
|
||||
this domain.
|
||||
";
|
||||
};
|
||||
|
||||
autoVersioning = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether you want the Subversion subservice to support
|
||||
auto-versioning, which enables Subversion repositories to be
|
||||
mounted as read/writable file systems on operating systems that
|
||||
support WebDAV.
|
||||
";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
default = "/no/such/path/exists";
|
||||
description = "
|
||||
Place to put SVN repository.
|
||||
";
|
||||
};
|
||||
|
||||
organization = {
|
||||
|
||||
name = mkOption {
|
||||
default = null;
|
||||
description = "
|
||||
Name of the organization hosting the Subversion service.
|
||||
";
|
||||
};
|
||||
|
||||
url = mkOption {
|
||||
default = null;
|
||||
description = "
|
||||
URL of the website of the organization hosting the Subversion service.
|
||||
";
|
||||
};
|
||||
|
||||
logo = mkOption {
|
||||
default = null;
|
||||
description = "
|
||||
Logo the organization hosting the Subversion service.
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
} // # Include the options shared between the main server and virtual hosts.
|
||||
(import ../../upstart-jobs/apache-httpd/per-server-options.nix {
|
||||
inherit mkOption;
|
||||
forMainServer = true;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
mainCfg = config.services.httpd;
|
||||
|
||||
@ -361,20 +564,27 @@ let
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
name = "httpd";
|
||||
mkIf (config.services.httpd.enable && config.services.httpd.experimental) {
|
||||
require = [
|
||||
options
|
||||
];
|
||||
|
||||
users = [
|
||||
users = {
|
||||
extraUsers = [
|
||||
{ name = mainCfg.user;
|
||||
description = "Apache httpd user";
|
||||
}
|
||||
];
|
||||
|
||||
groups = [
|
||||
extraGroups = [
|
||||
{ name = mainCfg.group;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
services = {
|
||||
extraJobs = [{
|
||||
name = "httpd";
|
||||
|
||||
extraPath = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
|
||||
|
||||
@ -422,4 +632,7 @@ in
|
||||
respawn ${httpd}/bin/httpd -f ${httpdConf} -DNO_DETACH
|
||||
'';
|
||||
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -141,21 +141,6 @@ let
|
||||
inherit config;
|
||||
})
|
||||
|
||||
# Apache httpd.
|
||||
++ optional (config.services.httpd.enable && !config.services.httpd.experimental)
|
||||
(import ../upstart-jobs/httpd.nix {
|
||||
inherit config pkgs;
|
||||
inherit (pkgs) glibc;
|
||||
extraConfig = pkgs.lib.concatStringsSep "\n"
|
||||
(map (job: job.extraHttpdConfig) jobs);
|
||||
})
|
||||
|
||||
# Apache httpd (new style).
|
||||
++ optional (config.services.httpd.enable && config.services.httpd.experimental)
|
||||
(import ../upstart-jobs/apache-httpd {
|
||||
inherit config pkgs;
|
||||
})
|
||||
|
||||
# MySQL server
|
||||
++ optional config.services.mysql.enable
|
||||
(import ../upstart-jobs/mysql.nix {
|
||||
|
@ -1,4 +1,14 @@
|
||||
{config, pkgs, glibc, extraConfig}:
|
||||
{pkgs, config, ...}:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption mkIf;
|
||||
|
||||
# options have been moved to the apache-httpd/default.nix file
|
||||
|
||||
in
|
||||
|
||||
###### implementation
|
||||
|
||||
let
|
||||
|
||||
@ -22,6 +32,11 @@ let
|
||||
|
||||
startingDependency = if config.services.gw6c.enable && config.services.gw6c.autorun then "gw6c" else "network-interfaces";
|
||||
|
||||
|
||||
extraConfig = pkgs.lib.concatStringsSep "\n"
|
||||
(pkgs.lib.catAttrs "extraHttpdConfig" config.services.extraJobs);
|
||||
|
||||
|
||||
webServer = import ../../services/apache-httpd {
|
||||
inherit (pkgs) apacheHttpd coreutils;
|
||||
stdenv = pkgs.stdenv;
|
||||
@ -32,6 +47,7 @@ let
|
||||
user group adminAddr logDir stateDir
|
||||
applicationMappings;
|
||||
noUserDir = !cfg.enableUserDir;
|
||||
|
||||
extraDirectories = extraConfig + "\n" + cfg.extraConfig;
|
||||
|
||||
subServices =
|
||||
@ -72,31 +88,35 @@ let
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
/* ++
|
||||
|
||||
(optional cfg.extraSubservices.enable
|
||||
(map (service : service webServer pkgs) cfg.extraSubservices.services)
|
||||
) */;
|
||||
);
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
name = "httpd";
|
||||
mkIf (config.services.httpd.enable && !config.services.httpd.experimental) {
|
||||
|
||||
users = [
|
||||
require = [
|
||||
# options have been moved to the apache-httpd/default.nix file
|
||||
];
|
||||
|
||||
users = {
|
||||
extraUsers = [
|
||||
{ name = user;
|
||||
description = "Apache httpd user";
|
||||
}
|
||||
];
|
||||
|
||||
groups = [
|
||||
extraGroups = [
|
||||
{ name = group;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
job = "
|
||||
services = {
|
||||
extraJobs = [{
|
||||
name = "httpd";
|
||||
|
||||
job = ''
|
||||
description \"Apache HTTPD\"
|
||||
|
||||
start on ${startingDependency}/started
|
||||
@ -107,6 +127,8 @@ start script
|
||||
end script
|
||||
|
||||
respawn ${webServer}/bin/control run
|
||||
";
|
||||
'';
|
||||
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user