module(wp): more phpfpm fine tuning and user/groups + mysql
This commit is contained in:
parent
ec070af5a3
commit
ee508bb37c
2 changed files with 27 additions and 4 deletions
|
@ -30,10 +30,23 @@ in {
|
||||||
};
|
};
|
||||||
enablePageSpeed = mkOption {
|
enablePageSpeed = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = pkgs.stdenv.isLinux && appConfig.googlePageSpeed.enable;
|
default = false; # TODO: backport some patch first, pkgs.stdenv.isLinux && appConfig.googlePageSpeed.enable; - https://github.com/apache/incubator-pagespeed-ngx/issues/1735
|
||||||
|
};
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "wordpress";
|
||||||
|
};
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "wordpress";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
users.users.${cfg.user} = {
|
||||||
|
inherit (cfg) group;
|
||||||
|
};
|
||||||
|
users.groups.${cfg.group} = {};
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.wp-cli ];
|
environment.systemPackages = [ pkgs.wp-cli ];
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
|
@ -79,6 +92,7 @@ in {
|
||||||
|
|
||||||
services.phpfpm = {
|
services.phpfpm = {
|
||||||
pools.wordpress-pool = import ./phpfpm-conf.nix {
|
pools.wordpress-pool = import ./phpfpm-conf.nix {
|
||||||
|
inherit (cfg) user group;
|
||||||
inherit pkgs config phpFpmListen;
|
inherit pkgs config phpFpmListen;
|
||||||
phpPackage = php;
|
phpPackage = php;
|
||||||
processSettings = appConfig.phpFpmProcessSettings;
|
processSettings = appConfig.phpFpmProcessSettings;
|
||||||
|
@ -88,6 +102,16 @@ in {
|
||||||
services.mysql = {
|
services.mysql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.mariadb;
|
package = pkgs.mariadb;
|
||||||
|
|
||||||
|
ensureDatabases = [ "wordpress" ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = cfg.user;
|
||||||
|
ensurePermissions = {
|
||||||
|
"wordpress.*" = "ALL PRIVILEGES";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
{ pkgs, config, phpFpmListen, processSettings, phpPackage }:
|
{ pkgs, config, phpFpmListen, processSettings, phpPackage, user, group }:
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit (config.services.nginx) user group;
|
inherit user group phpPackage;
|
||||||
inherit phpPackage;
|
|
||||||
settings = {
|
settings = {
|
||||||
"listen.owner" = config.services.nginx.user;
|
"listen.owner" = config.services.nginx.user;
|
||||||
"listen.group" = config.services.nginx.group;
|
"listen.group" = config.services.nginx.group;
|
||||||
|
|
Loading…
Reference in a new issue