{ lib, config, pkgs, ... }: let cfg = config.myServices.websites.christophe_carpentier.agora-project; varDir = "/var/lib/ftp/christophe_carpentier/agora-project"; apacheUser = config.services.httpd.Inte.user; apacheGroup = config.services.httpd.Inte.group; in { options.myServices.websites.christophe_carpentier.agora-project.enable = lib.mkEnableOption "enable Christophe Carpentier's agora-project"; config = lib.mkIf cfg.enable { system.activationScripts.christophe_carpentier_agora_project = { deps = [ "httpd" "users" ]; text = '' install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${varDir} install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/christophe_carpentier ''; }; services.phpfpm.pools.christophe_carpentier_agora_project = { user = apacheUser; group = apacheGroup; settings = { "listen.owner" = apacheUser; "listen.group" = apacheGroup; "pm" = "ondemand"; "pm.max_children" = "5"; "pm.process_idle_timeout" = "60"; "php_admin_value[open_basedir]" = "/var/lib/php/sessions/christophe_carpentier:${varDir}:/tmp"; "php_admin_value[session.save_path]" = "/var/lib/php/sessions/christophe_carpentier"; "php_admin_value[upload_max_filesize]" = "20M"; "php_admin_value[post_max_size]" = "20M"; }; phpOptions = config.services.phpfpm.phpOptions + '' disable_functions = "mail" ''; phpPackage = pkgs.php74; }; services.websites.env.production.modules = [ "proxy_fcgi" ]; services.websites.env.integration.vhostConfs.christophe_carpentier_agora_project = { certName = "integration"; addToCerts = true; hosts = ["agora-project.cc.immae.dev"]; root = varDir; extraConfig = [ '' SetHandler "proxy:unix:${config.services.phpfpm.pools.christophe_carpentier_agora_project.socket}|fcgi://localhost" DirectoryIndex index.php index.htm index.html Options Indexes FollowSymLinks MultiViews Includes AllowOverride All Require all granted '' ]; }; }; }