{ config, lib, pkgs, ... }: let xok = pkgs.stdenv.mkDerivation { name = "php-root"; buildCommand = '' mkdir $out; echo ' ' > $out/index.php; ''; }; cfg = config.services.nginx; in { services.nginx = { enable = true; virtualHosts."default" = { root = "/data/webserver"; default = true; extraConfig = '' location ~ \.php$ { document_root ${xok}; include ${cfg.package}/conf/fastcgi_params fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } ''; }; }; }