From 52c97adaba852a612d801332ce84c503680ff497 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Mon, 23 Jul 2012 21:48:21 +0200 Subject: [PATCH] modules/services/web-servers/apache-httpd: make this module more configurable - The new option 'apacheHttpd' determines the version of the Apache HTTP Server that's being used by this module. The default version is Apache 2.2.x, as before. - The new option 'configFile' allows users specify their own custom config file for the web server instead of being limited to the one that this module generates. --- .../web-servers/apache-httpd/default.nix | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/modules/services/web-servers/apache-httpd/default.nix b/modules/services/web-servers/apache-httpd/default.nix index 2eadde36e16..41cf31e4473 100644 --- a/modules/services/web-servers/apache-httpd/default.nix +++ b/modules/services/web-servers/apache-httpd/default.nix @@ -6,7 +6,9 @@ let mainCfg = config.services.httpd; - httpd = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; + httpd = mainCfg.apacheHttpd; + + httpdConf = mainCfg.configFile; php = pkgs.php.override { apacheHttpd = httpd; }; @@ -280,7 +282,7 @@ let ''; - httpdConf = pkgs.writeText "httpd.conf" '' + confFile = pkgs.writeText "httpd.conf" '' ServerRoot ${httpd} @@ -403,10 +405,29 @@ in "; }; + apacheHttpd = mkOption { + default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; + example = "pkgs.apacheHttpd_2_4"; + description = " + Overridable attribute of the Apache HTTP Server package to use. + "; + }; + + configFile = mkOption { + default = confFile; + example = ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; + description = " + Overridable config file to use for Apache. By default, use the + file automatically generated by nixos. + "; + }; + extraConfig = mkOption { default = ""; description = " - These configuration lines will be passed verbatim to the apache config + These configuration lines will be appended to the Apache config + file. Note that this mechanism may not work when + is overridden. "; };