summary refs log tree commit diff
path: root/modules/services/web-servers/apache-httpd/default.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2010-02-15 19:02:42 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2010-02-15 19:02:42 +0000
commit83b76bc2cfd8d0d3d2205f08a73f36ab17d9ad3e (patch)
treea5029f4ab4ede1203623aa60f41fe68a2a89d5ab /modules/services/web-servers/apache-httpd/default.nix
parent014ffaac5d48f64073994b8644f659ee98c3023f (diff)
downloadnixpkgs-83b76bc2cfd8d0d3d2205f08a73f36ab17d9ad3e.tar
nixpkgs-83b76bc2cfd8d0d3d2205f08a73f36ab17d9ad3e.tar.gz
nixpkgs-83b76bc2cfd8d0d3d2205f08a73f36ab17d9ad3e.tar.bz2
nixpkgs-83b76bc2cfd8d0d3d2205f08a73f36ab17d9ad3e.tar.lz
nixpkgs-83b76bc2cfd8d0d3d2205f08a73f36ab17d9ad3e.tar.xz
nixpkgs-83b76bc2cfd8d0d3d2205f08a73f36ab17d9ad3e.tar.zst
nixpkgs-83b76bc2cfd8d0d3d2205f08a73f36ab17d9ad3e.zip
* Option `services.apache.phpIni' (which is of type derivation)
  replaced by `services.apache.phpOptions' (of type string).
* Allow Apache subservices to add to phpOptions.
* Set the TZ environment variable in Apache.
* Updated the Zabbix web interface.

svn path=/nixos/trunk/; revision=20023
Diffstat (limited to 'modules/services/web-servers/apache-httpd/default.nix')
-rw-r--r--modules/services/web-servers/apache-httpd/default.nix84
1 files changed, 33 insertions, 51 deletions
diff --git a/modules/services/web-servers/apache-httpd/default.nix b/modules/services/web-servers/apache-httpd/default.nix
index 878e1c1f371..3659b75f22d 100644
--- a/modules/services/web-servers/apache-httpd/default.nix
+++ b/modules/services/web-servers/apache-httpd/default.nix
@@ -68,6 +68,7 @@ let
           globalEnvVars = [];
           robotsEntries = "";
           startupScript = "";
+          phpOptions = "";
           options = {};
         };
         res = defaults // svcFunction {inherit config pkgs serverInfo servicesPath;};
@@ -358,7 +359,18 @@ let
     }
   '';
 
-    
+
+  # Generate the PHP configuration file.  Should probably be factored
+  # out into a separate module.
+  phpIni = pkgs.runCommand "php.ini"
+    { options = concatStringsSep "\n"
+        ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices));
+    }
+    ''
+      cat ${pkgs.php}/etc/php-recommended.ini > $out
+      echo "$options" >> $out
+    '';
+
 in
 
 
@@ -464,54 +476,14 @@ in
         '';
       };
 
-      phpIni = mkOption {
-        default = pkgs.writeText "php.ini" ''
-           ; Needed for PHP's mail() function.
-           sendmail_path = sendmail -t -i
-         '';
-
-        example = ''
-        Example code (copy & paste):
-
-         most simple:
-         phpIni pkgs.writeText "php.ini" '''
-           ; Needed for PHP's mail() function.
-           sendmail_path = sendmail -t -i
-         ''';
-
-         using recommended settings and enabling Xdebug:
-         phpIni =  pkgs.phpIniBuilder.override {
-            appendLines = '''
-             sendmail_path = sendmail -t -i
-             zend_extension="''\${pkgs.phpXdebug}/lib/xdebug.so"
-             zend_extension_ts="''\${pkgs.phpXdebug}/lib/xdebug.so"
-             zend_extension_debug="''\${pkgs.phpXdebug}/lib/xdebug.so"
-             xdebug.remote_enable=true
-             xdebug.remote_host=127.0.0.1
-             xdebug.remote_port=9000
-             xdebug.remote_handler=dbgp
-             xdebug.profiler_enable=0
-             xdebug.profiler_output_dir="/tmp/xdebug"
-             xdebug.remote_mode=req
-            ''';
-          };
-        '';
-
-
-        description = ''
-          The contents of this option are used as global php.ini file by the
-          PHP interpreter used by Apache. You have to enable PHP explicitly.
-          See extraModules options.
-
-          This file defaults to defining sendmail_path only.
-
-          Note: Depending on your configuration you can set PHP ini values using .htaccess files and the
-          php_value option.
-
-          The example shows how to enable Xdebug and use the recommended
-          php.ini values which are contained in the PHP distribution.
-          I don't know whether they are equal to defaults
-        '';
+      phpOptions = mkOption {
+        default = "";
+        example =
+          ''
+            date.timezone = "CET"
+          '';
+        description =
+          "Options appended to the PHP configuration file <filename>php.ini</filename>.";
       };
 
     }
@@ -540,6 +512,15 @@ in
 
     environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
 
+    services.httpd.phpOptions =
+      ''
+        ; Needed for PHP's mail() function.
+        sendmail_path = sendmail -t -i
+
+        ; Apparently PHP doesn't use $TZ.
+        date.timezone = "${config.time.timeZone}"
+      '';
+
     jobs.httpd =
       { # Statically verify the syntactic correctness of the generated
         # httpd.conf.  !!! this is impure!  It doesn't just check for
@@ -570,7 +551,9 @@ in
                 optional config.networking.defaultMailServer.directDelivery "${pkgs.ssmtp}/sbin"
              ++ (concatMap (svc: svc.extraServerPath) allSubservices) );
 
-           PHPRC = mainCfg.phpIni;
+           PHPRC = phpIni;
+
+           TZ = config.time.timeZone;
 
           } // (listToAttrs (concatMap (svc: svc.globalEnvVars) allSubservices));
 
@@ -606,4 +589,3 @@ in
   };
   
 }
-