made php with own module

This commit is contained in:
naturallaw77 2025-02-13 01:40:37 -08:00
parent da033d8d09
commit bace5f0669
3 changed files with 70 additions and 59 deletions

View File

@ -3,31 +3,6 @@
let let
personalization = import ./modules/personalization.nix; personalization = import ./modules/personalization.nix;
custom-php = pkgs.php.buildEnv {
extensions = { enabled, all }: enabled ++ (with all; [ bz2 apcu redis imagick memcached ]);
extraConfig = ''
display_errors = On
display_startup_errors = On
max_execution_time = 10000
max_input_time = 3000
memory_limit = 1G;
opcache.enable=1;
opcache.memory_consumption=512;
opcache_revalidate_freq = 240;
opcache.max_accelerated_files=20000;
post_max_size = 3G
upload_max_filesize = 3G
apc.enable_cli=1
opcache.interned_strings_buffer = 64
redis.session.locking_enabled=1
redis.session.lock_retries=-1
redis.session.lock_wait_time=10000
'';
};
in in
{ {
@ -103,18 +78,7 @@ in
description = "free"; description = "free";
extraGroups = [ "networkmanager" ]; extraGroups = [ "networkmanager" ];
}; };
####### PHP user for PHPFPM #######
php = {
isSystemUser = true;
createHome = false;
uid = 7777;
}; };
};
users.users.php.group = "php";
users.groups.php = {};
# Enable automatic login for the user. # Enable automatic login for the user.
services.displayManager.autoLogin.enable = true; services.displayManager.autoLogin.enable = true;
@ -167,7 +131,6 @@ in
lm_sensors lm_sensors
hunspell hunspell
hunspellDicts.en_US hunspellDicts.en_US
custom-php
matrix-synapse-tools.synadm matrix-synapse-tools.synadm
brave brave
dua dua
@ -204,25 +167,6 @@ in
}; };
####### PHPFMP #######
services.phpfpm.pools = {
mypool = {
user = "caddy";
group = "php";
phpPackage = custom-php;
settings = {
"pm" = "dynamic";
"pm.max_children" = 75;
"pm.start_servers" = 10;
"pm.min_spare_servers" = 5;
"pm.max_spare_servers" = 20;
"pm.max_requests" = 500;
"clear_env" = "no";
};
};
};
####### CADDY ####### ####### CADDY #######
services.caddy = { services.caddy = {
enable = true; enable = true;

View File

@ -4,6 +4,7 @@
imports = [ imports = [
./php.nix
./synapse.nix ./synapse.nix
./coturn.nix ./coturn.nix
./bitcoinecosystem.nix ./bitcoinecosystem.nix

66
modules/php.nix Normal file
View File

@ -0,0 +1,66 @@
{ config, pkgs, lib, ... }:
let
custom-php = pkgs.php.buildEnv {
extensions = { enabled, all }: enabled ++ (with all; [ bz2 apcu redis imagick memcached ]);
extraConfig = ''
display_errors = On
display_startup_errors = On
max_execution_time = 10000
max_input_time = 3000
memory_limit = 1G;
opcache.enable=1;
opcache.memory_consumption=512;
opcache_revalidate_freq = 240;
opcache.max_accelerated_files=20000;
post_max_size = 3G
upload_max_filesize = 3G
apc.enable_cli=1
opcache.interned_strings_buffer = 64
redis.session.locking_enabled=1
redis.session.lock_retries=-1
redis.session.lock_wait_time=10000
'';
};
in
{
users.users = {
php = {
isSystemUser = true;
createHome = false;
uid = 7777;
};
};
users.users.php.group = "php";
users.groups.php = {};
environment.systemPackages = with pkgs; [
custom-php
];
services.phpfpm.pools = {
mypool = {
user = "caddy";
group = "php";
phpPackage = custom-php;
settings = {
"pm" = "dynamic";
"pm.max_children" = 75;
"pm.start_servers" = 10;
"pm.min_spare_servers" = 5;
"pm.max_spare_servers" = 20;
"pm.max_requests" = 500;
"clear_env" = "no";
};
};
};
}