summary refs log tree commit diff
path: root/nixos/modules/services/web-servers
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2019-07-03 17:34:17 -0400
committerAaron Andersen <aaron@fosslib.net>2019-08-23 07:56:21 -0400
commit62b774a7001f0d1d89d7ba6552c37b885c0189b7 (patch)
treea196de812394fc1e8290eb7bcb996df0ff6aca0c /nixos/modules/services/web-servers
parent2b5f6630154ac569ed503c2fd944c7c83aa05778 (diff)
downloadnixpkgs-62b774a7001f0d1d89d7ba6552c37b885c0189b7.tar
nixpkgs-62b774a7001f0d1d89d7ba6552c37b885c0189b7.tar.gz
nixpkgs-62b774a7001f0d1d89d7ba6552c37b885c0189b7.tar.bz2
nixpkgs-62b774a7001f0d1d89d7ba6552c37b885c0189b7.tar.lz
nixpkgs-62b774a7001f0d1d89d7ba6552c37b885c0189b7.tar.xz
nixpkgs-62b774a7001f0d1d89d7ba6552c37b885c0189b7.tar.zst
nixpkgs-62b774a7001f0d1d89d7ba6552c37b885c0189b7.zip
nixos/phpfpm: add socket option to replace the listen option
Diffstat (limited to 'nixos/modules/services/web-servers')
-rw-r--r--nixos/modules/services/web-servers/phpfpm/default.nix28
1 files changed, 25 insertions, 3 deletions
diff --git a/nixos/modules/services/web-servers/phpfpm/default.nix b/nixos/modules/services/web-servers/phpfpm/default.nix
index a96ac052d00..75913640d72 100644
--- a/nixos/modules/services/web-servers/phpfpm/default.nix
+++ b/nixos/modules/services/web-servers/phpfpm/default.nix
@@ -14,7 +14,7 @@ let
     ${cfg.extraConfig}
 
     [${pool}]
-    listen = ${poolOpts.listen}
+    listen = ${poolOpts.socket}
     ${poolOpts.extraConfig}
   '';
 
@@ -29,11 +29,24 @@ let
     cat $phpPackage/etc/php.ini $nixDefaultsPath $phpOptionsPath > $out
   '';
 
-  poolOpts = { lib, ... }:
+  poolOpts = { lib, name, ... }:
+    let
+      poolOpts = cfg.pools."${name}";
+    in
     {
       options = {
+        socket = mkOption {
+          type = types.str;
+          readOnly = true;
+          description = ''
+            Path to the unix socket file on which to accept FastCGI requests.
+            <note><para>This option is read-only and managed by NixOS.</para></note>
+          '';
+        };
+
         listen = mkOption {
           type = types.str;
+          default = "";
           example = "/path/to/unix/socket";
           description = ''
             The address on which to accept FastCGI requests.
@@ -77,6 +90,10 @@ let
           '';
         };
       };
+
+      config = {
+        socket = if poolOpts.listen == "" then "${stateDir}/${name}.sock" else poolOpts.listen;
+      };
     };
 
 in {
@@ -121,7 +138,6 @@ in {
         example = literalExample ''
          {
            mypool = {
-             listen = "/path/to/unix/socket";
              phpPackage = pkgs.php;
              extraConfig = '''
                user = nobody
@@ -144,6 +160,12 @@ in {
 
   config = mkIf (cfg.pools != {}) {
 
+    warnings =
+      mapAttrsToList (pool: poolOpts: ''
+        Using config.services.phpfpm.pools.${pool}.listen is deprecated and will become unsupported. Please reference the read-only option config.services.phpfpm.pools.${pool}.socket to access the path of your socket.
+      '') (filterAttrs (pool: poolOpts: poolOpts.listen != "") cfg.pools)
+    ;
+
     systemd.slices.phpfpm = {
       description = "PHP FastCGI Process manager pools slice";
     };