nixos/phpfpm: remove options services.phpfpm.poolConfigs
This commit is contained in:
parent
6093c04b67
commit
eee87b460e
@ -240,6 +240,12 @@ with lib;
|
|||||||
# binfmt
|
# binfmt
|
||||||
(mkRenamedOptionModule [ "boot" "binfmtMiscRegistrations" ] [ "boot" "binfmt" "registrations" ])
|
(mkRenamedOptionModule [ "boot" "binfmtMiscRegistrations" ] [ "boot" "binfmt" "registrations" ])
|
||||||
|
|
||||||
|
# PHP-FPM
|
||||||
|
(mkRemovedOptionModule [ "services" "phpfpm" "poolConfigs" ] "Use services.phpfpm.pools instead.")
|
||||||
|
(mkRemovedOptionModule [ "services" "phpfpm" "phpPackage" ] "Use services.phpfpm.pools.<name>.phpPackage instead.")
|
||||||
|
(mkRemovedOptionModule [ "services" "phpfpm" "phpOptions" ] "Use services.phpfpm.pools.<name>.phpOptions instead.")
|
||||||
|
(mkRenamedOptionModule [ "services" "phpfpm" "extraConfig" ] [ "services" "phpfpm" "globalExtraConfig" ])
|
||||||
|
|
||||||
] ++ (flip map [ "blackboxExporter" "collectdExporter" "fritzboxExporter"
|
] ++ (flip map [ "blackboxExporter" "collectdExporter" "fritzboxExporter"
|
||||||
"jsonExporter" "minioExporter" "nginxExporter" "nodeExporter"
|
"jsonExporter" "minioExporter" "nginxExporter" "nodeExporter"
|
||||||
"snmpExporter" "unifiExporter" "varnishExporter" ]
|
"snmpExporter" "unifiExporter" "varnishExporter" ]
|
||||||
|
@ -4,37 +4,26 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.phpfpm;
|
cfg = config.services.phpfpm;
|
||||||
enabled = cfg.poolConfigs != {} || cfg.pools != {};
|
enabled = cfg.pools != {};
|
||||||
|
|
||||||
poolConfigs =
|
poolConfigs = (mapAttrs mapPool cfg.pools);
|
||||||
(mapAttrs mapPoolConfig cfg.poolConfigs) //
|
|
||||||
(mapAttrs mapPool cfg.pools);
|
|
||||||
|
|
||||||
mapPoolConfig = n: p: {
|
|
||||||
phpPackage = cfg.phpPackage;
|
|
||||||
phpOptions = cfg.phpOptions;
|
|
||||||
config = p;
|
|
||||||
};
|
|
||||||
|
|
||||||
mapPool = n: p: {
|
mapPool = n: p: {
|
||||||
phpPackage = p.phpPackage;
|
phpPackage = p.phpPackage;
|
||||||
phpOptions = p.phpOptions;
|
phpOptions = p.phpOptions;
|
||||||
userPool = p.user;
|
userPool = p.user;
|
||||||
groupPool = p.group;
|
groupPool = p.group;
|
||||||
config = ''
|
|
||||||
${p.extraConfig}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fpmCfgFile = pool: conf: pkgs.writeText "phpfpm-${pool}.conf" ''
|
fpmCfgFile = pool: conf: pkgs.writeText "phpfpm-${pool}.conf" ''
|
||||||
[global]
|
[global]
|
||||||
error_log = syslog
|
error_log = syslog
|
||||||
daemonize = no
|
daemonize = no
|
||||||
${cfg.extraConfig}
|
${cfg.globalExtraConfig}
|
||||||
|
|
||||||
[${pool}]
|
[${pool}]
|
||||||
listen = /run/phpfpm-${pool}/${cfg.pools.${pool}.socketName}.sock
|
listen = /run/phpfpm-${pool}/${cfg.pools.${pool}.socketName}.sock
|
||||||
${conf}
|
${cfg.pools.${pool}.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
phpIni = pool: pkgs.runCommand "php.ini" {
|
phpIni = pool: pkgs.runCommand "php.ini" {
|
||||||
@ -51,67 +40,79 @@ let
|
|||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
services.phpfpm = {
|
services.phpfpm = {
|
||||||
extraConfig = mkOption {
|
globalExtraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
Extra configuration that should be put in the global section of
|
Global extra configuration that should be put in the global section of
|
||||||
the PHP-FPM configuration file. Do not specify the options
|
the PHP-FPM configuration file. Do not specify the options
|
||||||
<literal>error_log</literal> or
|
<literal>error_log</literal> or
|
||||||
<literal>daemonize</literal> here, since they are generated by
|
<literal>daemonize</literal> here, since they are generated by NixOS.
|
||||||
NixOS.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
phpPackage = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.php;
|
|
||||||
defaultText = "pkgs.php";
|
|
||||||
description = ''
|
|
||||||
The PHP package to use for running the PHP-FPM service.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
phpOptions = mkOption {
|
|
||||||
type = types.lines;
|
|
||||||
default = "";
|
|
||||||
example =
|
|
||||||
''
|
|
||||||
date.timezone = "CET"
|
|
||||||
'';
|
|
||||||
description =
|
|
||||||
"Options appended to the PHP configuration file <filename>php.ini</filename>.";
|
|
||||||
};
|
|
||||||
|
|
||||||
poolConfigs = mkOption {
|
|
||||||
default = {};
|
|
||||||
type = types.attrsOf types.lines;
|
|
||||||
example = literalExample ''
|
|
||||||
{ mypool = '''
|
|
||||||
listen = /run/phpfpm/mypool
|
|
||||||
user = nobody
|
|
||||||
pm = dynamic
|
|
||||||
pm.max_children = 75
|
|
||||||
pm.start_servers = 10
|
|
||||||
pm.min_spare_servers = 5
|
|
||||||
pm.max_spare_servers = 20
|
|
||||||
pm.max_requests = 500
|
|
||||||
''';
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
description = ''
|
|
||||||
A mapping between PHP-FPM pool names and their configurations.
|
|
||||||
See the documentation on <literal>php-fpm.conf</literal> for
|
|
||||||
details on configuration directives. If no pools are defined,
|
|
||||||
the phpfpm service is disabled.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
pools = mkOption {
|
pools = mkOption {
|
||||||
type = types.attrsOf (types.submodule (import ./pool-options.nix {
|
|
||||||
inherit lib config;
|
|
||||||
}));
|
|
||||||
default = {};
|
default = {};
|
||||||
|
type = types.attrsOf (types.submodule {
|
||||||
|
options = {
|
||||||
|
socketName = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "php-fpm";
|
||||||
|
description = ''
|
||||||
|
The address on which to accept FastCGI requests.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
phpPackage = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = fpmCfg.phpPackage;
|
||||||
|
defaultText = "config.services.phpfpm.phpPackage";
|
||||||
|
description = ''
|
||||||
|
The PHP package to use for running this PHP-FPM pool.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
phpOptions = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = fpmCfg.phpOptions;
|
||||||
|
defaultText = "config.services.phpfpm.phpOptions";
|
||||||
|
description = ''
|
||||||
|
"Options appended to the PHP configuration file <filename>php.ini</filename> used for this PHP-FPM pool."
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
default = "phpfpm";
|
||||||
|
description = "User account under which phpfpm runs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
default = "phpfpm";
|
||||||
|
description = "Group account under which phpfpm runs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
example = ''
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 75
|
||||||
|
pm.start_servers = 10
|
||||||
|
pm.min_spare_servers = 5
|
||||||
|
pm.max_spare_servers = 20
|
||||||
|
pm.max_requests = 500
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Extra lines that go into the pool configuration.
|
||||||
|
See the documentation on <literal>php-fpm.conf</literal> for
|
||||||
|
details on configuration directives.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
example = literalExample ''
|
example = literalExample ''
|
||||||
{
|
{
|
||||||
mypool = {
|
mypool = {
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
{ lib, config }:
|
|
||||||
|
|
||||||
let
|
|
||||||
fpmCfg = config.services.phpfpm;
|
|
||||||
in
|
|
||||||
|
|
||||||
with lib; {
|
|
||||||
|
|
||||||
options = {
|
|
||||||
|
|
||||||
socketName = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
example = "php-fpm";
|
|
||||||
description = ''
|
|
||||||
The address on which to accept FastCGI requests.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
phpPackage = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
default = fpmCfg.phpPackage;
|
|
||||||
defaultText = "config.services.phpfpm.phpPackage";
|
|
||||||
description = ''
|
|
||||||
The PHP package to use for running this PHP-FPM pool.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
phpOptions = mkOption {
|
|
||||||
type = types.lines;
|
|
||||||
default = fpmCfg.phpOptions;
|
|
||||||
defaultText = "config.services.phpfpm.phpOptions";
|
|
||||||
description = ''
|
|
||||||
"Options appended to the PHP configuration file <filename>php.ini</filename> used for this PHP-FPM pool."
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
user = mkOption {
|
|
||||||
type = types.string;
|
|
||||||
default = "phpfpm";
|
|
||||||
description = "User account under which phpfpm runs.";
|
|
||||||
};
|
|
||||||
|
|
||||||
group = mkOption {
|
|
||||||
type = types.string;
|
|
||||||
default = "phpfpm";
|
|
||||||
description = "Group account under which phpfpm runs.";
|
|
||||||
};
|
|
||||||
|
|
||||||
extraConfig = mkOption {
|
|
||||||
type = types.lines;
|
|
||||||
example = ''
|
|
||||||
pm = dynamic
|
|
||||||
pm.max_children = 75
|
|
||||||
pm.start_servers = 10
|
|
||||||
pm.min_spare_servers = 5
|
|
||||||
pm.max_spare_servers = 20
|
|
||||||
pm.max_requests = 500
|
|
||||||
'';
|
|
||||||
|
|
||||||
description = ''
|
|
||||||
Extra lines that go into the pool configuration.
|
|
||||||
See the documentation on <literal>php-fpm.conf</literal> for
|
|
||||||
details on configuration directives.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user