From ca031ce720b3d39c0d6869af0fbd79551cc79176 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 14 Sep 2008 01:30:45 +0000 Subject: [PATCH] httpd.extraModules: now accpets string items loading modules beeing distributed by apache removed pkgs : arg svn path=/nixos/trunk/; revision=12861 --- system/options.nix | 9 +++++---- upstart-jobs/apache-httpd/default.nix | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/system/options.nix b/system/options.nix index e17e587430c..5c51d777b98 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1716,11 +1716,12 @@ in }; extraModules = mkOption { - default = pkgs : []; + default = []; + example = [ "proxy_connect" { name = "php5_module"; path = "${pkgs.php}/modules/libphp5.so"; } ]; description = '' - used to add additional modules - Example for PHP: - pkgs : [ { name = "php5_module"; path = "${pkgs.php}/modules/libphp5.so" } ] + Loads additional modules either beeing distributed with apache. + If the module is contained in a foreign package (such as php5_module) + kse an attrset as given in the example. ''; }; diff --git a/upstart-jobs/apache-httpd/default.nix b/upstart-jobs/apache-httpd/default.nix index 6a4e9116dc9..7cc23e5cfce 100644 --- a/upstart-jobs/apache-httpd/default.nix +++ b/upstart-jobs/apache-httpd/default.nix @@ -12,7 +12,10 @@ let getPort = cfg: if cfg.port != 0 then cfg.port else if cfg.enableSSL then 443 else 80; - + + extraModules = pkgs.lib.traceWhatis ( pkgs.lib.getAttr ["extraModules"] [] mainCfg; + extraForeignModules = pkgs.lib.filter builtins.isAttrs extraModules; + extraApachaModules = pkgs.lib.filter (x :! (builtins.isAttrs x)) extraModules; # I'd prefer using builtins.isString here, but doesn't exist yet makeServerInfo = cfg: { # Canonical name must not include a trailing slash. @@ -105,7 +108,7 @@ let "mime" "dav" "status" "autoindex" "asis" "info" "cgi" "dav_fs" "vhost_alias" "negotiation" "dir" "imagemap" "actions" "speling" "userdir" "alias" "rewrite" "proxy" "proxy_http" - ] ++ optional enableSSL "ssl"; + ] ++ optional enableSSL "ssl" ++ extraApachaModules; loggingConf = '' @@ -297,8 +300,7 @@ let allModules = concatMap (svc: svc.extraModulesPre) allSubservices ++ map (name: {inherit name; path = "${httpd}/modules/mod_${name}.so";}) apacheModules ++ - concatMap (svc: svc.extraModules) allSubservices ++ - (pkgs.lib.getAttr ["extraModules"] (x:[]) mainCfg) pkgs; + concatMap (svc: svc.extraModules) allSubservices ++ extraForeignModules; in concatMapStrings load allModules }