Skip to content

Commit 9fbc8ce

Browse files
authored
Merge pull request #781 from flyingcircusio/phil/named-php-pools
lamp: named php pools
2 parents 5ecb43e + f5ef965 commit 9fbc8ce

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

nixos/roles/lamp.nix

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ in {
4040
};
4141

4242
vhosts = mkOption {
43-
type = with types; listOf (submodule {
43+
type = with types; listOf (submodule ({ config, ... }: {
4444
options = {
4545
port = mkOption { type = int; };
4646
docroot = mkOption { type = str; };
@@ -56,8 +56,12 @@ in {
5656
description = "Overrides for underlying NixOS Pool options";
5757
default = {};
5858
};
59+
name = mkOption {
60+
type = str;
61+
default = "lamp-${toString config.port}";
62+
};
5963
};
60-
});
64+
}));
6165
default = [];
6266
};
6367

@@ -206,7 +210,7 @@ in {
206210
DirectoryIndex index.html index.php
207211
</Directory>
208212
<FilesMatch "\.php$">
209-
SetHandler "proxy:unix:${config.services.phpfpm.pools."lamp-${port}".socket}|fcgi://localhost/"
213+
SetHandler "proxy:unix:${config.services.phpfpm.pools."${vhost.name}".socket}|fcgi://localhost/"
210214
</FilesMatch>
211215
${vhost.apacheExtraConfig}
212216
</VirtualHost>
@@ -222,7 +226,7 @@ in {
222226

223227
services.phpfpm.pools = builtins.listToAttrs (map
224228
(vhost: {
225-
name = "lamp-${toString vhost.port}";
229+
inherit (vhost) name;
226230
value = lib.attrsets.recursiveUpdate {
227231
user = config.services.httpd.user;
228232
group = config.services.httpd.group;

0 commit comments

Comments
 (0)