From f5ef965397c8c397d48ba8000ea1ed3eb0297319 Mon Sep 17 00:00:00 2001 From: Philipp Herzog Date: Wed, 13 Sep 2023 10:48:36 +0200 Subject: [PATCH] lamp: named php pools --- nixos/roles/lamp.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nixos/roles/lamp.nix b/nixos/roles/lamp.nix index 537c0e86b..5fdd2c295 100644 --- a/nixos/roles/lamp.nix +++ b/nixos/roles/lamp.nix @@ -40,7 +40,7 @@ in { }; vhosts = mkOption { - type = with types; listOf (submodule { + type = with types; listOf (submodule ({ config, ... }: { options = { port = mkOption { type = int; }; docroot = mkOption { type = str; }; @@ -56,8 +56,12 @@ in { description = "Overrides for underlying NixOS Pool options"; default = {}; }; + name = mkOption { + type = str; + default = "lamp-${toString config.port}"; + }; }; - }); + })); default = []; }; @@ -206,7 +210,7 @@ in { DirectoryIndex index.html index.php - SetHandler "proxy:unix:${config.services.phpfpm.pools."lamp-${port}".socket}|fcgi://localhost/" + SetHandler "proxy:unix:${config.services.phpfpm.pools."${vhost.name}".socket}|fcgi://localhost/" ${vhost.apacheExtraConfig} @@ -222,7 +226,7 @@ in { services.phpfpm.pools = builtins.listToAttrs (map (vhost: { - name = "lamp-${toString vhost.port}"; + inherit (vhost) name; value = lib.attrsets.recursiveUpdate { user = config.services.httpd.user; group = config.services.httpd.group;