-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8be0ed
commit f88e4ac
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Wordpress | ||
|
||
```nix title="devenv.nix" | ||
{ pkgs, config, ... }: | ||
{ | ||
packages = with pkgs;[ | ||
git | ||
wp-cli | ||
]; | ||
languages.php.enable = true; | ||
languages.php.package = pkgs.php82.buildEnv { | ||
extensions = { all, enabled }: with all; enabled ++ [ redis pdo_mysql xdebug ]; | ||
extraConfig = '' | ||
memory_limit = -1 | ||
xdebug.mode = debug | ||
xdebug.start_with_request = yes | ||
xdebug.idekey = vscode | ||
xdebug.log_level = 0 | ||
max_execution_time = 0 | ||
''; | ||
}; | ||
languages.php.fpm.pools.web = { | ||
settings = { | ||
"clear_env" = "no"; | ||
"pm" = "dynamic"; | ||
"pm.max_children" = 10; | ||
"pm.start_servers" = 2; | ||
"pm.min_spare_servers" = 1; | ||
"pm.max_spare_servers" = 10; | ||
}; | ||
}; | ||
certificates = [ | ||
"wp.localhost" | ||
]; | ||
# This lets Caddy bind to 443 | ||
scripts.caddy-setcap.exec = '' | ||
sudo setcap 'cap_net_bind_service=+ep' ${pkgs.caddy}/bin/caddy | ||
''; | ||
services.redis.enable = true; | ||
# Links to MariaDB internally | ||
services.mysql = { | ||
enable = true; | ||
settings.mysqld = { | ||
max_allowed_packet = "512M"; | ||
}; | ||
}; | ||
services.mysql.initialDatabases = [{name = "wp"; }]; | ||
services.mysql.ensureUsers = [ | ||
{ | ||
name = "wordpress"; | ||
password = "YourSecretSauceHere"; | ||
ensurePermissions = { "wp.*" = "ALL PRIVILEGES"; }; | ||
} | ||
]; | ||
services.caddy.enable = true; | ||
services.caddy.virtualHosts."wp.localhost" = { | ||
extraConfig = '' | ||
tls ${config.env.DEVENV_STATE}/mkcert/wp.localhost.pem ${config.env.DEVENV_STATE}/mkcert/wp.localhost-key.pem | ||
root * . | ||
php_fastcgi unix/${config.languages.php.fpm.pools.web.socket} | ||
file_server | ||
''; | ||
}; | ||
} | ||
``` |