From a8bc5b67f8caf82585932eab14cb99fcbc4d595b Mon Sep 17 00:00:00 2001 From: Eric Sagnes Date: Fri, 29 Apr 2016 15:26:20 +0900 Subject: [PATCH] php: add default php.ini --- nixos/modules/rename.nix | 1 + .../web-servers/apache-httpd/default.nix | 2 +- nixos/modules/services/web-servers/phpfpm.nix | 21 ++++++++++++++----- pkgs/development/interpreters/php/default.nix | 6 ++---- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 6b02446d53b4..5c4793624e02 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -123,6 +123,7 @@ with lib; (mkRemovedOptionModule [ "services" "printing" "cupsFilesConf" ]) (mkRemovedOptionModule [ "services" "printing" "cupsdConf" ]) (mkRemovedOptionModule [ "services" "xserver" "startGnuPGAgent" ]) + (mkRemovedOptionModule [ "services" "phpfpm" "phpIni" ]) ]; } diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 7953729c00cd..c23897192b4c 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -406,7 +406,7 @@ let ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices)); } '' - cat ${php}/etc/php-recommended.ini > $out + cat ${php}/etc/php.ini > $out echo "$options" >> $out ''; diff --git a/nixos/modules/services/web-servers/phpfpm.nix b/nixos/modules/services/web-servers/phpfpm.nix index 6a60000ce19e..2658d7117e37 100644 --- a/nixos/modules/services/web-servers/phpfpm.nix +++ b/nixos/modules/services/web-servers/phpfpm.nix @@ -19,6 +19,12 @@ let ${concatStringsSep "\n" (mapAttrsToList (n: v: "[${n}]\n${v}") cfg.poolConfigs)} ''; + phpIni = pkgs.writeText "php.ini" '' + ${readFile "${cfg.phpPackage}/etc/php.ini"} + + ${cfg.phpOptions} + ''; + in { options = { @@ -44,10 +50,15 @@ in { ''; }; - phpIni = mkOption { - type = types.path; - default = "${cfg.phpPackage}/etc/php-recommended.ini"; - description = "php.ini file to use."; + phpOptions = mkOption { + type = types.lines; + default = ""; + example = + '' + date.timezone = "CET" + ''; + description = + "Options appended to the PHP configuration file php.ini."; }; poolConfigs = mkOption { @@ -84,7 +95,7 @@ in { mkdir -p "${stateDir}" ''; serviceConfig = { - ExecStart = "${cfg.phpPackage}/sbin/php-fpm -y ${cfgFile} -c ${cfg.phpIni}"; + ExecStart = "${cfg.phpPackage}/bin/php-fpm -y ${cfgFile} -c ${phpIni}"; PIDFile = pidFile; }; }; diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix index a618fd85d719..d59273a18c3e 100644 --- a/pkgs/development/interpreters/php/default.nix +++ b/pkgs/development/interpreters/php/default.nix @@ -265,14 +265,12 @@ let --replace '@PHP_LDFLAGS@' "" done - iniFile=$out/etc/php-recommended.ini [[ -z "$libxml2" ]] || export PATH=$PATH:$libxml2/bin ./configure --with-config-file-scan-dir=/etc --with-config-file-path=$out/etc --prefix=$out $configureFlags ''; - installPhase = '' - unset installPhase; installPhase; - cp php.ini-production $iniFile + postInstall = '' + cp php.ini-production $out/etc/php.ini ''; src = fetchurl {